/* 余計な隙間とスクロールバーを完全に消す */
* {
    box-sizing: border-box;
}

/* 全体 */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    /* 縦揺れ防止 */
    overflow: hidden;
    background-color: #000;
}

.slider-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    /* dvh = ブラウザのバーを除いた「実際に見えている高さ」に合わせる設定 */
    height: 100vh;
    height: 100dvh; 
}

/* 画像を表示するエリア */
.slides {
    flex: 1; /* 余ったスペースをすべて使う */
    min-height: 0; /* flex内の要素がはみ出さないようにする魔法の1行 */
    position: relative;
    background-color: #000;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.slide {
    display: none;
    width: 100%;
    height: 100%;
}

.slide.active {
    display: block;
}

.slide-img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 画像を枠内に収める */
    user-select: none;
    -webkit-user-drag: none;
}

/* --- コントロールエリア（ここを重点的に修正） --- */
.controls {
    /* flex-shrink: 0; を入れることで、画像に押されてもこのエリアが潰れなくなります */
    flex-shrink: 0; 
    
    /* 高さを固定ではなく、最低限の高さ(min-height)に変更 */
    min-height: 80px; 
    height: auto;
    
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    background-color: #333;

    /* 縦向きの時は余白を少し詰め、横向きの時はゆったりさせる（レスポンシブ） */
    padding-top: 10px;
    padding-bottom: constant(safe-area-inset-bottom); /* iPhone等の下のバー対策 */
    padding-bottom: env(safe-area-inset-bottom);
}

/* 縦向き(Portrait)の時の微調整 */
@media screen and (orientation: portrait) {
    .controls {
        padding-bottom: 30px; /* 下側のボタンを少し上に上げる */
        min-height: 100px;
    }
}

.slide-num {
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    min-width: 80px;
    text-align: center;
    user-select: none;
}

button {
    padding: 12px 24px; /* 少し大きめにして押しやすく */
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    border: none;
    background-color: #eee;
    touch-action: manipulation;
}

button:active {
    background-color: #bbb;
}
