/* ====================================================
   生命の樹｜Tree of Life ── 専用スタイル
   ==================================================== */

/* --- ページレイアウト --- */
.tree-header {
    text-align: center;
    padding: 2rem 1rem 1rem;
    position: relative;
}

/* 言語切り替えトグルの配置 (PC用) */
.tree-header .lang-toggle-container,
.report-header .lang-toggle-container {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    width: auto;
    margin: 0;
    justify-content: flex-end;
}

/* モバイル用: 戻るボタン等と重ならないよう、絶対配置を解除してタイトル下に配置 */
@media (max-width: 767px) {
    .tree-header .lang-toggle-container,
    .report-header .lang-toggle-container {
        position: static;
        display: flex;
        justify-content: center;
        margin: 1rem auto 0;
        width: 100%;
    }
}

.back-link {
    display: inline-block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--accent-gold);
}

.tree-page-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 300;
    color: var(--accent-gold);
    letter-spacing: 0.1em;
    margin-bottom: 0.3rem;
}

.tree-page-subtitle {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 300;
    font-size: 0.95rem;
    color: var(--text-secondary);
    letter-spacing: 0.15em;
}

/* --- メインレイアウト --- */
.tree-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 900px) {
    .tree-main {
        flex-direction: row;
        align-items: flex-start;
        gap: 3rem;
    }
}

@media (max-width: 767px) {
    .tree-main { padding: 0.5rem; gap: 1rem; }
    .tree-container { padding: 5px; max-width: 100%; width: 100vw; height: auto; margin-top: -10px; }
}

/* --- SVGコンテナ --- */
.tree-container {
    width: 100%;
    max-width: 650px;
    aspect-ratio: 5 / 7;
    position: relative;
    padding: 20px;
    transition: transform 0.15s ease-out;
    transform-style: preserve-3d;
    will-change: transform;
}

#tree-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* ====================================================
   パスのスタイル（脈動・高視認性）
   ==================================================== */
.tree-path {
    stroke: rgba(212, 175, 55, 0.4); /* 視認性を高めるため濃くする */
    stroke-width: 2;
    fill: none;
    cursor: pointer;
    transition: stroke 3s ease, stroke-width 3s ease, filter 3s ease; /* ホタルのようにゆっくり消える */
}

.path-group:hover .tree-path,
.tree-path.active {
    stroke: var(--accent-gold);
    stroke-width: 3.5;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.7));
    transition: stroke 0.4s ease, stroke-width 0.4s ease, filter 0.4s ease; /* 現れる時はスッと */
}

.tree-path.reading-highlight {
    stroke: #FFD700;
    stroke-width: 4.5;
    filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.9));
    animation: pulseGlowPath 2s infinite alternate;
}


/* パスのヘブライ文字ラベル */
.path-label {
    fill: rgba(212, 175, 55, 0.7); /* 視認性を高めるため濃くする */
    font-size: 10px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
    transition: fill 0.3s;
}

.path-group:hover + .path-label,
.path-group:has(.tree-path.active) + .path-label {
    fill: var(--accent-gold);
}

/* --- 深淵ライン --- */
.abyss-line {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1;
    stroke-dasharray: 8, 6;
    fill: none;
}

.abyss-label {
    fill: rgba(255, 255, 255, 0.15);
    font-family: var(--font-heading);
    font-size: 11px;
    text-anchor: middle;
    letter-spacing: 0.3em;
}

/* --- セフィラ（球） --- */
.sephira-group {
    cursor: pointer;
}

.sephira-circle {
    fill: rgba(20, 20, 30, 0.8);
    stroke: rgba(212, 175, 55, 0.3);
    stroke-width: 1.5;
    transition: all 3s ease; /* ホタルのようにゆっくり消える */
}

.sephira-group:hover .sephira-circle,
.sephira-group.active .sephira-circle {
    stroke: var(--accent-gold);
    stroke-width: 2.5;
    fill: rgba(74, 35, 90, 0.9); /* 紫系に統一 */
    filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.4));
    transition: all 0.4s ease; /* 現れる時はスッと */
}

/* セフィラの内側の光 */
.sephira-glow {
    opacity: 0;
    transition: all 3s ease; /* ゆっくり消える */
}

.sephira-group:hover .sephira-glow,
.sephira-group.active .sephira-glow {
    transition: all 0.4s ease; /* 現れる時はスッと */
}

.sephira-group:hover .sephira-glow,
.sephira-group.active .sephira-glow {
    opacity: 1;
    stroke-width: 3px; /* 選択時は線を太くして視認性を高める */
    /* ビナーなどの暗い色でも視認できるように、うっすら白い発光を足す */
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.4));
}

/* セフィラの名前 */
.sephira-name-en {
    fill: var(--accent-gold);
    font-family: var(--font-heading);
    font-size: 11px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
    letter-spacing: 0.05em;
}

.sephira-name-ja {
    fill: var(--text-secondary);
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 300;
    font-size: 8px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.sephira-number {
    fill: rgba(212, 175, 55, 0.9);
    font-family: var(--font-heading);
    font-size: 15px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

/* ダアト（点線の円） */
.daath-circle {
    fill: transparent; /* fill: none だと線の上しかクリック判定されないため透明な塗りを指定 */
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1;
    stroke-dasharray: 4, 3;
    transition: all 0.4s;
}

.sephira-group:hover .daath-circle,
.sephira-group.active .daath-circle {
    stroke: rgba(255, 255, 255, 0.8);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
    stroke-width: 1.5;
}

/* --- 三柱のガイドライン（オプション） --- */
.pillar-line {
    stroke: rgba(255, 255, 255, 0.03);
    stroke-width: 1;
    stroke-dasharray: 2, 4;
}

/* --- リーディング結果のハイライト --- */
.sephira-group.reading-highlight .sephira-circle {
    stroke: #FFD700;
    stroke-width: 3;
    fill: rgba(212, 175, 55, 0.6);
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8));
    animation: pulseGlow 2s infinite alternate;
}

.tree-path.reading-highlight {
    stroke: #FFD700;
    stroke-width: 4;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
    animation: pulseGlowPath 2s infinite alternate;
}

.tree-path.reading-highlight + .path-label {
    fill: #FFD700;
    font-weight: bold;
}

@keyframes pulseGlow {
    from { filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5)); }
    to { filter: drop-shadow(0 0 25px rgba(255, 215, 0, 1)); }
}

@keyframes pulseGlowPath {
    from { stroke-width: 3; filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5)); }
    to { stroke-width: 5; filter: drop-shadow(0 0 15px rgba(255, 215, 0, 1)); }
}

/* --- アンビエント（生命の鼓動）エフェクト --- */
.sephira-group.ambient-glow .sephira-circle {
    stroke: rgba(212, 175, 55, 0.8);
    stroke-width: 2.5;
    fill: rgba(74, 35, 90, 0.6); /* 紫系でふんわり光る */
    filter: drop-shadow(0 0 12px rgba(138, 43, 226, 0.5));
    transition: all 3s ease-in-out;
}

.sephira-group.ambient-glow .sephira-glow {
    opacity: 0.8;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
    transition: all 3s ease-in-out;
}

.tree-path.ambient-glow {
    stroke: rgba(212, 175, 55, 0.8);
    stroke-width: 3.5;
    filter: drop-shadow(0 0 10px rgba(138, 43, 226, 0.6)); /* 紫系のグロー */
    transition: all 3s ease-in-out;
}

/* --- 情報パネル（モバイル・ボトムドロワー＆PC・サイドパネル） --- */
.tree-info-panel {
    width: 100%;
    /* モバイル・ボトムドロワーのベーススタイル */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    /* スワイプ用のハンドルのスペースを考慮したパディング */
    padding-top: 20px;
    /* デフォルトは画面下に隠す */
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* 背景色とグラスモーフィズム */
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.5);
    
    /* JSからの動的スワイプ更新に対応するための変数 */
    --drawer-offset: 0px; 
}

/* ドロワーがアクティブ（開いている）状態 */
.tree-info-panel.active-drawer {
    /* offsetも加味したY位置 */
    transform: translateY(calc(0px + var(--drawer-offset)));
}

/* 非アクティブ時にスワイプで引っ張られている状態（ちょっと見せる等）の補助 */
.tree-info-panel.inactive-drawer-drag {
    transform: translateY(calc(100% + var(--drawer-offset)));
    transition: none; /* ドラッグ中はアニメーションを切る */
}

/* ドラッグ中はトランジションを切って指に追従させる */
.tree-info-panel.dragging {
    transition: none;
}

/* ドロワーのドラッグハンドル */
.drawer-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    z-index: 2;
}

.drawer-handle:active {
    cursor: grabbing;
}

.drawer-handle::after {
    content: '';
    width: 40px;
    height: 4px;
    background: rgba(212, 175, 55, 0.5);
    border-radius: 2px;
}

/* パネル内部の要素 */
.info-panel-inner {
    position: relative;
    z-index: 1;
    /* モバイルドロワー用のパディングと高さ制限 */
    padding: 0.5rem 1.5rem 2rem;
    min-height: 40vh;
    max-height: 80vh;
    overflow-y: auto;
}

@media (min-width: 900px) {
    .tree-info-panel {
        position: sticky;
        top: 2rem;
        bottom: auto;
        left: auto;
        right: auto;
        transform: none !important; /* PCではドロワーのトランスフォームを無効化 */
        max-width: 400px;
        background: rgba(10, 10, 15, 0.5);
        border: 1px solid rgba(212, 175, 55, 0.2);
        border-radius: 16px;
        box-shadow: none;
        padding-top: 0;
    }

    .drawer-handle {
        display: none; /* PCではドラッグハンドル不要 */
    }

    .info-panel-inner {
        min-height: 300px;
        max-height: calc(100vh - 4rem);
        padding: 2rem;
        background: rgba(0, 0, 0, 0.2); /* PC用微調整 */
    }
}

.info-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

.info-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    opacity: 0.6;
    text-align: center;
}

/* 情報コンテンツ */
.info-content {
    animation: fadeIn 0.3s ease;
}

.info-content.hidden-section {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* セフィラ情報 */
.info-sephira-header {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
}

.info-sephira-number {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--accent-gold);
    opacity: 0.4;
    line-height: 1;
}

.info-sephira-name {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--accent-gold);
    letter-spacing: 0.05em;
}

.info-sephira-ja {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.info-divider {
    border: none;
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    margin: 1rem 0;
}

.info-desc {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.info-meta-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.4rem 1rem;
    font-size: 0.85rem;
}

.info-meta-label {
    color: var(--text-secondary);
    white-space: nowrap;
}

.info-meta-value {
    color: var(--text-primary);
}

/* 問い (Inquiry) */
.info-inquiry {
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(212, 175, 55, 0.05);
    border-left: 2px solid var(--accent-gold);
    border-radius: 0 4px 4px 0;
}

.info-inquiry-label {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    color: var(--accent-gold);
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.info-inquiry-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #FFF;
    font-weight: 300;
    font-style: italic;
}

/* 関連カード */
.info-cards-section {
    margin-top: 1.5rem;
}

.info-cards-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--accent-gold);
    letter-spacing: 0.1em;
    margin-bottom: 0.8rem;
}

.info-card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.info-card-chip {
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 0.8rem;
    color: var(--accent-gold);
    cursor: default;
    transition: all 0.3s;
}

.info-card-chip:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--accent-gold);
}

/* パス情報 */
.info-path-header {
    margin-bottom: 0.5rem;
}

.info-path-number {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
}

.info-path-card-name {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--accent-gold);
    letter-spacing: 0.05em;
}

.info-hebrew-large {
    font-size: 2rem;
    color: var(--accent-gold);
    opacity: 0.5;
    text-align: center;
    margin: 0.5rem 0;
    line-height: 1;
}

/* --- フッター --- */
.tree-footer {
    text-align: center;
    padding: 3rem 1rem 2rem;
    margin-top: 3rem;
}

.footer-back-link {
    display: inline-block;
    color: var(--accent-gold);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    transition: opacity 0.3s;
}

.footer-back-link:hover {
    opacity: 0.7;
}

.footer-copyright {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

.footer-rights {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.4;
    margin-top: 0.5rem;
}

/* ====================================================
   カード図鑑（Dictionary Modal）
   ==================================================== */
.dictionary-modal-content {
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2.5rem;
    position: relative;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.dictionary-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 768px) {
    .dictionary-layout {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .dictionary-image-section {
        flex: 0 0 320px;
        position: sticky;
        top: 0;
    }
}

/* 画像セクション */
.dictionary-image-section .tarot-img-wrapper {
    position: relative;
    width: 100%;
    border-radius: 8px;
    /* overflow: hidden はハイライト枠がクリップされるので削除 */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    display: block;
    line-height: 0; /* 画像下の謎の余白を除去 */
}

.dictionary-image-section .tarot-card-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* 情報セクション */
.dictionary-info-section {
    flex: 1;
}

.dictionary-card-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--accent-gold);
    margin-bottom: 0.2rem;
    letter-spacing: 0.05em;
}

.dictionary-card-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    padding-bottom: 1rem;
}

/* セクションタイトル */
.dictionary-section-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--accent-gold);
    letter-spacing: 0.1em;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* キーワード */
.dictionary-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dictionary-keyword-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* エソテリック・グリッド */
.esoteric-grid {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 3px solid var(--accent-gold);
}

.eso-label {
    color: var(--accent-gold);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.eso-value {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* シンボル解説 */
.dictionary-symbol-desc {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.6;
    min-height: 80px;
}
