body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
}

/* ヘッダー部分のスタイル修正 */
header {
    width: 100%;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 15px;
}

.header-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 1行目と2行目の間の余白調整 */
.header-row:first-child {
    margin-bottom: 5px;
}

/* 各要素の基本スタイル */
#topicSelector {
    width: auto;
    min-width: 80px; /* 最小幅を設定 */
}

.header-container button {
    white-space: nowrap; /* ボタンテキストを折り返さない */
}

#maxIndexDisplay {
    white-space: nowrap; /* テキストを折り返さない */
    margin: 0; /* 余白を削除 */
}

.image-container {
    width: 100%;
    height: calc(100vh - 120px);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto; /* 両方向のスクロールを有効にする */
    padding: 20px; /* スクロール余白を追加 */
    margin: 0;
    background-color: #f8f9fa; /* コンテナ背景色 */
}

#imageDisplay {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.2s ease; /* ズーム時のアニメーション */
    transform-origin: center center;
    box-shadow: 0 0 10px rgba(0,0,0,0.1); /* 画像に影を追加 */
}

/* ズーム時のスクロールバースタイル */
.image-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.image-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.image-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.image-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}
/* モバイル用の調整 - 一行表示を維持 */
@media (max-width: 768px) {
    .image-container {
        height: calc(100vh - 100px);
        padding: 10px;
    }
    
    .image-container::-webkit-scrollbar {
        width: 5px;
        height: 5px;
    }

    .header-container {
        gap: 8px;
        padding: 8px 15px;
    }
    
    /* モバイルでも折り返さず、横スクロール可能にする */
    header {
        -webkit-overflow-scrolling: touch; /* iOSでスムーズスクロール */
    }
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
}

.zoom-controls button {
    padding: 3px 10px;
    font-size: 0.9rem;
    width: 30px;
}

.zoom-display {
    font-size: 0.9rem;
    min-width: 50px;
    text-align: center;
}

/* モバイル用の調整 */
@media (max-width: 768px) {
    .header-row {
        gap: 8px;
    }
    
    .zoom-controls {
        gap: 3px;
    }
    
    .zoom-controls button {
        padding: 2px 8px;
        font-size: 0.8rem;
        width: 25px;
    }
    
    .zoom-display {
        font-size: 0.8rem;
        min-width: 40px;
    }
}