body, html {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: #f3f3f3;
    color: #1a1a1a;
    user-select: none;
    -webkit-user-select: none; /* Safari用 */
    touch-action: none; /* ブラウザ標準のタッチ操作を無効化 */
}

/* キャンバス領域 */
#canvas-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    cursor: grab;
    overflow: hidden;
    /* 背景を斜めストライプに変更 */
    background-color: #f3f3f3;
    background-image: linear-gradient(45deg, #d4d4d4 1px, transparent 1px);
    background-size: 20px 20px;
}
#canvas-container:active {
    cursor: grabbing;
}

/* コンテンツ（変形の対象） */
#canvas-content {
    position: absolute;
    top: 50%; left: 50%; /* 中心基準 */
    width: 0; height: 0;
    transform-origin: 0 0;
    pointer-events: none; /* 子要素のイベントを通すため一旦none */
    z-index: 10;
}

/* SVG ラインレイヤー */
#connections {
    position: absolute;
    top: -5000px; left: -5000px; /* 広大な領域を確保 */
    width: 10000px; height: 10000px;
    pointer-events: none;
    overflow: visible;
}
line {
    stroke: #000;
    stroke-width: 2;
    transition: all 0.3s;
}

/* ノードコンテナ */
#nodes-layer {
    position: absolute;
    top: 0; left: 0;
    width: 0; height: 0;
    pointer-events: visible; /* ここだけイベント有効化 */
}

/* ノード（正方形）スタイル */
.node {
    position: absolute;
    width: 120px;
    height: 120px;
    background: var(--depth-bg, #fff);
    color: var(--depth-text, #000);
    border: 3px solid #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s, box-shadow 0.2s, color 0.2s;
    z-index: 10;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
    padding: 8px;
    margin-left: -60px;
    margin-top: -60px;
    -webkit-tap-highlight-color: transparent;
}

.node:hover, .node:active {
    transform: scale(1.05);
    background: #e60000 !important;
    color: #fff !important;
    box-shadow: 6px 6px 0 rgba(0,0,0,1);
    z-index: 100;
}

/* 展開済みノードのスタイル（グラデーションを維持、枠線で状態を示す） */
.node.expanded {
    border-color: #000;
    box-shadow: inset 0 0 0 2px #000, 4px 4px 0 rgba(0,0,0,0.1);
}
.node.expanded .node-tag {
    /* グラデーションに合わせて維持 */
}
.node.expanded:hover, .node.expanded:active {
    background: #e60000 !important;
    color: #fff !important;
}

/* ルートノード */
.node.root {
    width: 160px;
    height: 160px;
    margin-left: -80px;
    margin-top: -80px;
    border-width: 5px;
    z-index: 50;
}

/* NEWSノード（強調） */
.node.news {
    border-color: #e60000;
    background: #000;
    color: #e60000;
}
.node.news .node-tag {
    background: #e60000;
    color: #fff;
}

.node-tag {
    font-size: 0.6rem;
    font-weight: 900;
    background: #000;
    color: #fff;
    padding: 2px 6px;
    margin-bottom: 6px;
    text-transform: uppercase;
}
.node-title {
    font-weight: 900;
    font-size: 0.85rem;
    line-height: 1.2;
}
.root .node-title { font-size: 1.4rem; }

/* モーダル */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(4px);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content {
    background: #fff;
    width: 90%; max-width: 600px; max-height: 80%;
    padding: 40px;
    border: 4px solid #e60000; /* 赤に変更 */
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    overflow-y: auto;
    position: relative;
}
.modal-close {
    position: absolute; top: 0; right: 0;
    background: #000; color: #fff;
    padding: 10px 20px; cursor: pointer; font-weight: bold;
}
.modal-close:hover { background: #e60000; color: #fff; }

/* UI Controls */
.controls {
    position: fixed;
    bottom: 20px; right: 20px;
    display: flex; gap: 10px;
    z-index: 150;
}
.btn {
    background: #fff; border: 2px solid #000;
    width: 40px; height: 40px;
    font-weight: bold; cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 2px 2px 0 #000;
}
.btn:hover, .btn:active { background: #e60000; color: #fff; transform: translate(-1px, -1px); box-shadow: 3px 3px 0 #000; }

/* NEWS LIST (Fixed Position) */
.news-container {
    position: fixed;
    bottom: 40px;
    left: 40px;
    /* z-index: 1 に設定し、ノード(10)より背面にする */
    z-index: 1;
    max-width: 340px;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    pointer-events: none; 
}
.news-item {
    background: rgba(255, 255, 255, 0.8); /* 少し透過させて背面感を出す */
    padding: 20px;
    border: 1px solid #ccc;
    /* 影を薄くして主張を抑える */
    box-shadow: none;
    pointer-events: auto;
}

/* ニュース内部コンテンツのスタイル */
.news-item h2 {
    font-size: 1.2rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    opacity: 0.9;
}
.news-item p {
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    color: #333;
}
.news-item p.font-bold {
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 0.8rem;
}
.news-item a {
    color: #e60000; /* リンクも赤系に */
    text-decoration: underline;
}

/* --- LIST VIEW STYLE --- */
#list-view-container {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #fff;
    color: #1a1a1a;
    overflow-y: auto;
    padding: 60px 20px;
    display: none;
    z-index: 50;
    font-family: 'Noto Sans JP', sans-serif;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
    user-select: text;
}
.list-content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 100px; /* 下部に余裕を持たせる */
}
.list-title {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 3rem;
    border-bottom: 4px solid #000;
    padding-bottom: 1rem;
    line-height: 1.1;
}

/* リスト構造の基本 */
.lv-ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

/* 入れ子になったリスト（2階層目以降）のデザイン */
.lv-ul .lv-ul {
    padding-left: 20px;      /* インデント幅 */
    margin-left: 5px;        /* 親の線との距離 */
    margin-top: 5px;
    margin-bottom: 15px;
}

/* リストアイテム */
.lv-li {
    margin-bottom: 8px;
    position: relative;
}

/* グループタイトル（フォルダ名） */
.lv-group-title {
    font-size: 1.1rem;
    font-weight: 900;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #000;
    line-height: 1.4;
}

/* トップレベルのセクションタイトル（NEWS, 研究室について, etc） */
.section-title {
    font-size: 1.5rem;
    font-weight: 900;
    margin-top: 3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    display: block;
}

/* 末端項目（リンクなど） */
.lv-item {
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s;
    padding: 2px 0;
    line-height: 1.5;
    color: #333;
}
.lv-item:hover {
    color: #e60000;
    text-decoration: underline;
}

/* タグ */
.lv-tag {
    font-size: 0.65rem;
    font-weight: 700;
    background: #eee;
    color: #333;
    padding: 2px 6px;
    margin-right: 8px;
    border-radius: 4px;
    white-space: nowrap;
    vertical-align: middle;
}

/* アイコン */
.lv-icon {
    margin-left: 6px;
    width: 14px;
    height: 14px;
    opacity: 0.4;
}

/* トグルボタン */
.view-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 180px; /* コントロールボタンの左隣 */
    background: #000;
    color: #fff;
    font-weight: 900;
    padding: 0 20px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 160;
    box-shadow: 2px 2px 0 #000;
    border: 2px solid #fff; /* コントロールボタンとスタイル合わせる */
    font-size: 0.8rem;
    white-space: nowrap;
}
.view-toggle-btn:hover {
    background: #e60000;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 #000;
}
.view-toggle-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #000;
}
