/* 全体の背景色とパネルのスタイルを設定 */
body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f0f0f0;
    margin: 0;
}

/* コントロールパネルのグリッドレイアウトを設定 */
.control-panel {
    display: grid;
    grid-template-columns: 120px 120px 120px 120px; /* グリッドの列の数と幅 */
    grid-template-rows: 120px 120px 120px 120px 120px; /* グリッドの行の数と高さ */
    grid-gap: 30px; /* グリッドアイテム間のスペース */
    padding: 60px;
    background-color: #fff;
    border: 2px solid #ccc;
    border-radius: 10px;
    width: 800px; /* パネルの幅 */
    height: 530px; /* パネルの高さ */
    position: relative;
}

/* ボタン、インジケーター、レバーの基本スタイル */
.button, .indicator, .lever {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #000;
    border-radius: 10px;
    font-size: 16px;
    user-select: none;
    position: relative;
    flex-direction: column;
}

/* 非常停止ボタンのスタイル */
.emergency-stop {
    width: 150px;
    height: 150px;
    background-color: #ff0000; /* 普通の赤色 */
    color: #fff;
    border-radius: 50%;
    position: absolute;
    top: 100px;
    right: 660px; /* 初期位置を設定。好きな位置に変更可能 */
}

/* その他のボタンのスタイル */
.button {
    background-color: #ff0000;
    cursor: pointer;
    color: #000;
}

/* インジケーターのスタイル */
.indicator {
    background-color: #f0f0f0; /* 薄い色 */
    width: 100px;
    height: 100px;
}

/* 丸ボタンのスタイル */
.round-button {
    border-radius: 50%;
    width: 100px;
    height: 100px;
}

/* 黒丸ボタンのスタイル */
.round-black-button {
    border-radius: 50%;
    width: 100px;
    height: 100px;
    background-color: #000;
    color: #fff;
    position: absolute;
    top: 440px;
    right: 65px;
}

#barrier-close-completion span {
    position: absolute;
    bottom: -20px;
    white-space: nowrap;
    color: #000;
}

/* 各インジケーターのスタイル */
#full_open_lamp { background-color: #ffe5e5; color: #000; grid-column: 3 / 4; grid-row: 1 / 2; } /* 薄い赤 */
#full_close_lamp { background-color: #e5ffe5; color: #000; grid-column: 4 / 4; grid-row: 1 / 3; } /* 薄い緑 */
#obstruction_lamp { background-color: #fff8e5; color: #000; grid-column: 1 / 2; grid-row: 3 / 4; } /* 薄い黄色 */
#error_lamp { background-color: #ffe5e5; color: #000; grid-column: 2 / 3; grid-row: 3 / 4; } /* 薄い赤 */
#relay_close_mode_lamp { background-color: #e5e5ff; color: #000; grid-column: 1 / 2; grid-row: 4 / 4; } /* 薄い青 */
#operation-allowed { background-color: #e5ffe5; color: #000; grid-column: 4 / 4; grid-row: 4 / 4; } /* 薄い緑 */
#close {
    background-color: #00ff00; /* 緑でんき　あれ */
    color: #000;
    grid-column: 4 / 4;
    grid-row: 2 / 4;
}
#video-container {
    grid-column: 2 / 4; /* 2列目から4列目までを使う */
    grid-row: 4 / 5;    /* 4行目に配置 */
    width: 43%;
    height: 95%;
    border: 2px solid #000; /* 黒い枠線を追加 */
    border-radius: 10px; /* 角を丸くする */
    overflow: hidden; /* コンテナ外の部分を隠す */
    position: relative; /* transformの基準をこのコンテナにする */
}

#video {
    width: 100%;
    height: 100%;
    position: absolute; /* ビデオ位置をabsoluteで調整 */
    transform: scale(3) translate(-30%, 0%); /* ここで拡大倍率と位置を指定 */
    transform-origin: center; /* 拡大の基準を中央に設定 */
}



#open {
    background-color: #eeff00; /* 赤 */
    color: #000;
    grid-column: 3 / 4;
    grid-row: 2 / 4;
}

#relay_close {
    background-color: #0000ff; /* 青 */
    color: #000;
    grid-column: 4 / 4;
    grid-row: 3 / 4;
}

/* レバーのスタイル */
.lever {
    flex-direction: column;
    height: 120px;
    width: 120px;
    padding: 5px;
    border-radius: 10px;
}

/* これ警告ベル */
#warning-bell {
    position: absolute;
    top: 50px;
    right: 50px;
}

/* 発車予告 */
#departure-warning {
    position: absolute;
    top: 220px;
    right: 50px;
}

/* 各ボタンやインジケーターのラベルをボタンから少し離して配置する */
.button span, .indicator span {
    position: absolute;
    top: -30px; /* ボタンやインジケーターから離す距離を設定 */
    text-align: center;
    width: 100%;
    color: #000;
}

/* レバーのラベルを少し離して配置する */
.lever-label span {
    position: absolute;
    top: 0px; /* ボタンやインジケーターから離す距離を設定 */
    text-align: center;
    width: 100%;
    color: #000;
}

/* 乗降終了 */
.round-black-button span {
    position: absolute;
    top: -55px; /* ボタンやインジケーターから離す距離を設定 */
    text-align: center;
    width: 100%;
    color: #000;
}

/* ハンドルのスタイル1 */
.switch {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #e0e0e0;
    border-radius: 10px;
    margin-top: 0px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/* ハンドルのスタイル2 */
.handle {
    position: absolute;
    width: 20px;
    height: 65px; /* つまみを長く */
    background-color: #000;
    border-radius: 30%;
    transform-origin: center;
    transition: transform 0.3s ease;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
}

.label {
    position: absolute;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    color: #000;
    top: 5px;
}

.manual {
    left: 5px;
    cursor: pointer;
}

.off {
    left: 50%;
    transform: translateX(-50%);
    cursor: pointer;
}

.auto {
    right: 5px;
    cursor: pointer;
}

span {
    position: absolute;
    top: -20px;
    white-space: nowrap;
    color: #000;
}

.lit {
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.8);
}

#video {
    grid-column: 2 / 4; /* 2列目から4列目までを使用 */
    grid-row: 4 / 5;    /* 4行目に配置 */
    width: 100%;        /* 横幅を100%に設定 */
    height: 100%;       /* 高さも100%に設定 */
    border: 2px solid #000; /* 黒い枠線を追加 */
    border-radius: 10px;    /* 角を丸くする */
}



@media (max-width: 768px) {
    .control-panel {
        grid-template-columns: repeat(2, 1fr); /* 列を2つに減らす */
        grid-template-rows: repeat(6, 1fr); /* 行を増やす */
        row-gap: 40px; /* グリッドアイテム間の上下スペースを設定 */
        column-gap: 20px; /* グリッドアイテム間の左右スペースを設定 */
        height: auto; /* パネルの高さを自動にする */
        padding: 50px 30px 10px 30px; /* 追加のパディングを設定 */
        margin: 10px 10px 10px 10px; /* 左右上下の余白を設定 */
    }

    .button, .indicator, .lever {
        width: 70px; /* 幅を小さくする */
        height: 70px; /* 高さを小さくする */
        font-size: 12px; /* フォントサイズを小さくする */
    }

    .emergency-stop {
        width: 100px; /* 幅を小さくする */
        height: 100px; /* 高さを小さくする */
        top: 60px; /* 上からの位置を調整 */
        right: 265px; /* 右からの位置を調整 */
    }

    .round-black-button {
        width: 80px; /* 幅を小さくする */
        height: 80px; /* 高さを小さくする */
        top: 580px; /* 上からの位置を調整 */
        right: 20px; /* 右からの位置を調整 */
    }

    .lever {
        width: 100px; /* 幅を小さくする */
        height: 100px; /* 高さを小さくする */
    }

    .lever-label span {
        top: -15px; /* ラベルの位置を調整 */
    }

    .switch {
        height: 80px; /* ハンドルの高さを小さくする */
    }

    .handle {
        height: 50px; /* ハンドルの長さを小さくする */
    }

    .label {
        font-size: 10px; /* フォントサイズを小さくする */
    }

    #warning-bell {
        top: 550px; /* 上からの位置を調整 */
        right: 290px; /* 右からの位置を調整 */
    }

    #departure-warning {
        top: 550px; /* 上からの位置を調整 */
        right: 140px; /* 右からの位置を調整 */
    }
}
