body {
    margin: 0;
    background-color: #111;
    overflow: hidden;
    color: white;
    font-family: 'Meiryo', sans-serif;
}

#container {
    width: 100vw;
    height: 100vh;
    cursor: grab;
}

#image {
    transform-origin: 0 0;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

body {
    margin: 0;
    background-color: #111;
    overflow: hidden;
    color: white;
    font-family: 'Meiryo', sans-serif;
}

#container {
    width: 100vw;
    height: 100vh;
    cursor: grab;
}

#image {
    transform-origin: 0 0;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

#header-title {
    position: absolute;
    top: 0;
    width: 100%;
    text-align: center;
    padding: 15px 0;
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(rgba(0, 0, 0, 0.8), transparent);
    pointer-events: none;
    z-index: 50;
    text-shadow: 0 2px 4px #000;
}

#toggle-ui-btn {
    position: absolute;
    top: 15px;
    left: 20px;
    z-index: 101;
    background: #1565C0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

#toggle-ui-btn:hover {
    background: #1976D2;
}

/* 検索UIのデザイン */
#ui {
    position: absolute;
    top: 65px;
    left: 20px;
    background: rgba(0, 0, 0, 0.85);
    padding: 15px;
    border-radius: 8px;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
    width: 280px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 140px);
}

#genre-search {
    padding: 8px;
    background: #222;
    color: white;
    border: 1px solid #555;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

#genre-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 5px;
    margin-bottom: 10px;
}

#timeline-bar { position: absolute; bottom: 0; width: 100%; height: 50px; background: linear-gradient(transparent, rgba(0,0,0,0.9)); z-index: 50; pointer-events: none; overflow: hidden; border-top: 1px solid rgba(255,255,255,0.1); }
.timeline-tick { position: absolute; bottom: 15px; transform: translateX(-50%); font-size: 14px; font-weight: bold; color: rgba(255,255,255,0.8); text-shadow: 0 1px 3px #000; }
.timeline-tick::after { content: ''; position: absolute; top: -10px; left: 50%; width: 1px; height: 8px; background: rgba(255,255,255,0.5); }

#tooltip {
    display: none;
    position: absolute;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    z-index: 200;
    
    /* autoにしてテキスト選択を可能にする */
    pointer-events: auto; 
    
    border: 1px solid #555;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.8);
    
    /* 横展開＆見切れ対策 */
    max-width: 85vw; /* 画面幅の85%まで広がるのを許可 */
    max-height: 80vh; /* 縦にはみ出る場合はスクロール */
    overflow-y: auto;
}

.genre-item {
    cursor: pointer;
    padding: 6px 8px;
    font-size: 13px;
    background: #222;
    border-radius: 4px;
    transition: 0.2s;
}

.genre-item:hover {
    background: #1565C0;
    font-weight: bold;
    transform: translateX(5px);
}

button {
    padding: 10px;
    cursor: pointer;
    background: #444;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
    transition: 0.2s;
}

button:hover {
    background: #666;
}

/* --- お問い合わせボタンのスタイル --- */
#contact-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 101;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: 0.2s;
    backdrop-filter: blur(5px);
}
#contact-btn:hover {
    background: #1565C0;
    border-color: #1976D2;
}

/* --- モーダル（ポップアップ）のスタイル --- */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(3px);
}
.modal-content {
    background: #1e1e1e;
    padding: 30px;
    border-radius: 10px;
    width: 350px;
    max-width: 90%;
    border: 1px solid #444;
    box-shadow: 0 10px 25px rgba(0,0,0,0.8);
    position: relative;
    text-align: center;
}
.close-btn {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
}
.close-btn:hover { color: white; }
.modal-link-btn {
    display: block;
    background: #1565C0;
    color: white;
    padding: 12px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    transition: 0.2s;
}
.modal-link-btn:hover { opacity: 0.9; transform: translateY(-2px); }

/* --- SNSリンクのスタイル --- */
.sns-link {
    color: #42A5F5;
    text-decoration: none;
    font-size: 13px;
    font-weight: bold;
    padding: 6px 12px;
    background: #222;
    border-radius: 4px;
    border: 1px solid #444;
    transition: 0.2s;
}
.sns-link:hover {
    background: #1565C0;
    color: white;
    border-color: #1976D2;
}

/* --- スマホ向けのレスポンシブ対応 --- */
@media (max-width: 768px) {
    /* 1. タイトルを少し小さくしてスペースを節約 */
    #header-title {
        font-size: 16px;
        padding: 10px 0;
    }
    
    /* 2. 左上の「検索を表示/非表示」ボタンをタイトルの下に配置 */
    #toggle-ui-btn {
        top: 45px;
        left: 10px;
        font-size: 12px;
        padding: 8px 10px;
    }

    /* 3. 右上のボタン群もタイトルの下に配置し、縦並びにする */
    #top-right-menu {
        top: 45px !important; 
        right: 10px !important;
        flex-direction: column;
        align-items: flex-end;
        gap: 6px !important;
    }

    #contact-btn, #lang-toggle-btn {
        font-size: 11px;
        padding: 6px 10px;
    }

    /* 4. 検索UIを「各種ボタン群の下」にズラす（重なり解消のキモ） */
    #ui {
        top: 120px; /* ここを大きく取ることでボタンとの衝突を回避 */
        left: 5%;
        width: 90%; 
        box-sizing: border-box; /* paddingを含めて画面幅90%に収める */
        max-height: calc(100vh - 140px); /* 画面下部に突き抜けないように制限 */
        padding: 12px;
    }

    /* スマホではタップしやすいようにリストの余白を少し広げる */
    .genre-item {
        padding: 10px 8px;
        font-size: 14px;
    }

    /* タイムラインの文字を小さく */
    .timeline-tick {
        font-size: 11px;
    }
}