    body {
            zoom: 0.8;
            /* Arrange block-wrapper and grid-wrapper side by side */
            display: flex;
            flex-wrap: nowrap;
            flex-direction: row;
            align-items: flex-start;
            gap: 20px;
            min-height: 100vh;
            margin: 0;
            padding: 0px 20px 40px 20px;
            box-sizing: border-box;
            font-family: Arial, sans-serif;
            overflow-x: hidden;
            overflow-y: auto;
        }

        /* .grid-wrapper-container {
            display: block;
            position: relative;
            width: 100%;
            } */

            .grid-wrapper {
                margin-top: 5px;
                margin-left: 420px; /* JSで動的上書きされる（フォールバック値） */
                position: relative;
                overflow: visible;
                z-index: 10;
                align-self: flex-start;
            }
            /* 基準階非表示時：1階・2階グリッド以外の子要素を隠す */
            .grid-wrapper.base-floor-hidden > :not(#grid-wrapper-duplicate):not(#grid-wrapper-second) {
                display: none !important;
            }

        .block-wrapper {
            /* display:absolute; is invalid CSS, removed */
            /* flex-direction: column; */
            justify-content: flex-start;
            /* gap: 100px; */
            /* flex: 0 0 auto; */
        }
        
        
        .label-container {
            width: 260px;
            min-width: 260px;
            margin-right: 4px;
            display: flex;
            align-items: stretch;
            overflow: hidden;
            border-left: 1px solid #ccc;
            border-right: 1px solid #ccc;
        }
        /* 部門まとめグループ：各行の左ボーダーはグループ外側のみ */
        .dept-combined-wrapper .block-wrapper {
            border-left: none;
        }
        
        .block-container {
            /* keep block panel at fixed width */
            flex: 0 0 auto;
            /* float: left; */
            display: flex; /* ブロック設定を表示する */
            flex-direction: column;
            gap: 0;
            align-items: flex-start;
            margin-right: 10px; /* Adjusted gap between block and grid container */
            width: 500px; /* JSで実計測後に上書きされる初期値 */
            position: fixed !important; /* スクロール時に追従 */
            left: 0px; /* 左端からの距離 */
            top: 20px; /* 上端からの距離 */
            z-index: 1000; /* 他の要素より前面に表示 */
            background-color: white; /* 背景色を設定 */
            padding: 8px; /* 内側の余白 */
            border-radius: 8px; /* 角を丸く */
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* 影を追加 */
            max-height: calc(100vh - 40px); /* 画面高さから余白を引いた最大高さ */
            overflow-y: auto; /* 内容が多い場合はスクロール可能 */
            overflow-x: hidden;
            border: 1px solid #e0e0e0; /* 境界線を追加 */
        }

        .block-wrapper {
            display: flex;
            align-items: stretch;
            border-bottom: 1px solid #ccc;
        }
        /* ブロック・カウント・回転ボタンは縦中央に固定 */
        .block-wrapper .block,
        .block-wrapper .count-input,
        .block-wrapper .rotate-button,
        .block-wrapper .change-count-button {
            align-self: center;
            flex-shrink: 0;
        }
        /* テキストのみの背景色を設定 */
        /* 部門タグ（namedRoomsブロック左側に表示） */
        .block-dept-label {
            display: inline-block;
            font-size: 10px;
            font-weight: bold;
            color: #fff;
            padding: 1px 4px;
            border-radius: 3px;
            margin-right: 3px;
            vertical-align: middle;
            white-space: nowrap;
            line-height: 1.4;
        }
        .block-dept-label.dept-gray   { background-color: #888; }
        .block-dept-label.dept-purple { background-color: #8e44ad; }
        .block-dept-label.dept-blue   { background-color: #2980b9; }
        .block-dept-label.dept-orange { background-color: #e67e22; }
        .block-dept-label.dept-yellow { background-color: #b8860b; color: #fff; }
        .block-dept-label.dept-green  { background-color: #27ae60; }

        .block-label {
            display: flex;
            align-items: stretch;
            width: 100%;
            font-size: 14px;
            color: #333;
            border: none;
            text-decoration: none;
        }

        /* 室名列 */
        .block-label .text {
            width: 130px;
            min-width: 130px;
            padding: 15px 5px;
            font-size: 13px;
            color: #333;
            background-color: white;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            box-sizing: border-box;
            border-right: 1px solid #ccc;
            display: flex;
            align-items: center;
        }
        /* 部門グループヘッダー */
        .dept-group-header {
            width: 100%;
            font-size: 11px;
            font-weight: bold;
            color: #fff;
            padding: 3px 8px;
            border-radius: 3px;
            margin-top: 10px;
            box-sizing: border-box;
        }
        /* 特記列 */
        .block-label .block-toki {
            width: 50px;
            min-width: 50px;
            padding: 8px 4px;
            font-size: 11px;
            color: #c00;
            background-color: white;
            white-space: normal;
            word-break: break-all;
            box-sizing: border-box;
            border-right: 1px solid #ccc;
            display: flex;
            align-items: center;
        }
        /* 面積列 */
        .block-label .block-area-text {
            width: 80px;
            min-width: 80px;
            font-size: 12px;
            color: #666;
            background-color: white;
            padding: 15px 5px;
            margin-left: 0;
            white-space: nowrap;
            box-sizing: border-box;
            border-right: 1px solid #ccc;
            display: flex;
            align-items: center;
            justify-content: flex-start;
        }
        /* 配置済みブロック上の名前・面積ラベル */
        .placed-block-label {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 18px;
            font-weight: bold;
            color: #000;
            text-shadow: 0 1px 2px rgba(255,255,255,0.6);
            white-space: nowrap;
            pointer-events: none;
            z-index: 6;
            text-align: center;
            line-height: 1;
        }
        .block {
            cursor: move;
            display: flex;
            flex-wrap: wrap;
            flex-shrink: 0; /* flexコンテナに縮小させない */
            /* width: 46px; */
            /* height: 46px; */
            /* margin-right: 10px; */
            position: relative;
            border: 2px solid black;
            z-index: 10;
            /* box-sizing: border-box; */
        }

        .block.small {
            border: 2px solid black;
            /* box-sizing: border-box; */
            width: 13px; height:25px;
        }

        .block.small.rotated {
             width: 25px !important;
             height:13px !important;
             box-sizing: border-box;
             background-clip:padding-box;
             overflow: hidden;
            }

        .block.kanri {
            border: 2px solid black;
            width: 13px; height: 25px;
        }

        .block.kanri.rotated {
            width: 25px !important;
            height: 13px !important;
            box-sizing: border-box;
            background-clip: padding-box;
            overflow: hidden;
        }

        .block.red { width: 25px; height: 25px; }
        .block.fujo { width: 25px; height: 25px; }
        .block.lightblue { width: 25px; height: 25px; }
        .block.purple { width: 25px; height: 25px; }
        .block.yellow { width: 50px; height: 50px; }
        .block.green {
            width: 75px;
            height: 50px;
            border: 2px solid black;
            background-color: #2ecc71;
            position: relative;
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            grid-template-rows: repeat(2, 1fr);
            gap: 0;
        }
        
        /* 緑ブロックのセル */
        .block.green .block-cell {
            background-color: #2ecc71;
            border-right: 1px solid black;
            border-bottom: 1px solid black;
        }
        
        /* 右端のセルの境界線を調整 */
        .block.green .block-cell:nth-child(3n) {
            border-right: none;
        }
        
        /* 下端のセルの境界線を調整 */
        .block.green .block-cell:nth-child(n+4) {
            border-bottom: none;
        }
        
        /* 緑ブロックの回転状態（2×3の矩形） */
        .block.green.rotated {
            width: 50px;
            height: 75px;
            grid-template-columns: repeat(2, 1fr);
            grid-template-rows: repeat(3, 1fr);
        }
        
        /* 回転状態のセル */
        .block.green.rotated .block-cell {
            background-color: #2ecc71;
            border-right: 1px solid black;
            border-bottom: 1px solid black;
        }
        
        /* 回転状態の右端のセルの境界線を調整 */
        .block.green.rotated .block-cell:nth-child(2n) {
            border-right: none;
        }
        
        /* 回転状態の下端のセルの境界線を調整 */
        .block.green.rotated .block-cell:nth-child(n+5) {
            border-bottom: none;
        }

        .block.gray { width: 25px; height: 25px; }
        .block.graysmall { width: 13px; height: 25px; border: 2px solid black; }
        .block.graysmall.rotated { width: 25px !important; height: 13px !important; box-sizing: border-box; overflow: hidden; }

        /* 橙ブロック（3コマ居室）：3×1 */
        .block.orange {
            width: 75px;
            height: 25px;
        }
        /* 回転状態（1×3） */
        .block.orange.rotated {
            width: 25px !important;
            height: 75px !important;
        }

        .block-cell {
            width: 25px;
            height: 25px;
            border: 1px solid #ccc;
            box-sizing: border-box;
        }
        .blue { background-color: #3498db; }
        .fujo { background-color: #c8a87a; }
        .red { background-color: #ffffff; border: 1.5px solid #333 !important; }
        .lightblue { background-color: #084c79; }
        .purple { background-color: #e73ce4; }
        .yellow { background-color: #f1c40f; }
        .green { background-color: #2ecc71; }
        .block.gray, .highlight-container.gray, .block-cell.gray, .grid-item.gray.highlight { background-color: #95a5a6; }
        .block.graysmall, .highlight-container.graysmall, .block-cell.graysmall, .grid-item.graysmall.highlight { background-color: #95a5a6 !important; }
        .orange { background-color: #e67e22 !important; }
        .small { background-color: #33ff4e; }
        .kanri { background-color: #ffffff; border: 1.5px solid #333 !important; }
        .grid-container {
            display: inline-grid;
            grid-template-columns: repeat(6, 50px);
            gap: 0;
            position: relative;
            outline: 2px dashed rgb(15, 11, 238);
            outline-offset: 30px;
            overflow: visible;
        }
        
        /* 基準階プルダウンは道路マーカー（z-index:1）より前面に表示 */
        /* 1F/2F の wrapper 自体が z-index:5 なので、内部要素はそれに従う */
        .pulldown-container,
        .row-pulldown-container {
            z-index: 5;
        }

        /* #grid-wrapper-duplicate { */
            /* position: static !important; */
            /* order: 2 !important; */
            /* flex: 0 0 100% !important; */
            /* width: auto !important; */
            /* margin: 20px 0 0 0 !important; */
        /* } */
            
        .grid-item {
            width: 50px;
            height: 50px;
            border: 1px solid #7c7a7a;
            position: relative; /* 子要素の絶対配置を可能に */
            /* overflow: hidden; はみ出しを防止 */
            box-sizing: border-box;
            transition: background-color 0.3s;
            z-index: 5;
        }
        
        .grid-item.drag-over {
            background-color: rgba(52, 152, 219, 0.3);
        }
        .grid-item.highlight {
            border: 1px solid #ccc;
            z-index: 1;
        }
        .highlight-container {
            position: absolute;
            border: 2px solid black;
            pointer-events: none;
            z-index: 10;
            box-sizing: border-box;
        }
        .highlight-container.placed {
            pointer-events: auto;
            cursor: grab;
        }
        
        /* 緑ブロックのhighlight-container用スタイル */
        .highlight-container.green {
            background-color: #2ecc71;
        }
        
        .rotate-button, .change-count-button {
            cursor: pointer;
            padding: 5px;
            background-color: #f0f0f0;
            border: 1px solid #ccc;
            border-radius: 3px;
            margin-left: 5px;
        }
        .block[disabled] {
            opacity: 0.5;
            cursor: not-allowed;
        }
        /* 下記ブロックの数を決定するボックスのスタイル */
        .count-input {
            width: 30px;
            margin-left: 5px;
            height: 25px;
            text-align: right;
        }
        .intersection-line {
            position: absolute;
            /* width: 6px; */
            /* height: 6px; */
            background-color: rgba(100, 98, 98, 0.647);
            z-index: 10;
            transition: background-color 0.3s;
            pointer-events: none;
        }
        
        .line {
            z-index: 100;
            position: absolute;
            background-color: rgb(64, 39, 4);
            opacity: 0.85;
            pointer-events: none;
        }
        body.corridor-mode .line {
            pointer-events: auto;
            cursor: pointer;
        }
        .corridor {
            z-index: 100;
            position: absolute;
            background-color: rgb(64, 39, 4);
            opacity: 0.85;
            pointer-events: none;
        }
        .marker {
            position: absolute;
            z-index: 10;
            width: 10px;
            height: 10px;
            background-color: rgb(156, 12, 84);
            border-radius: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
        }

        /* 通用口パレット */
        .tsuyoguchi-palette {
            margin-top: 10px;
            padding: 8px 6px;
            border-top: 1px solid #ccc;
        }
        .entrance-palette-row {
            display: flex;
            flex-direction: row;
            gap: 8px;
            margin-top: 10px;
            padding: 8px 6px;
            border-top: 1px solid #ccc;
        }
        .tsuyoguchi-drag-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            cursor: grab;
            padding: 6px 8px;
            border: 1.5px dashed #c0392b;
            border-radius: 6px;
            background: #fff5f5;
            user-select: none;
            width: 60px;
        }
        .tsuyoguchi-drag-item:active { cursor: grabbing; }
        .tsuyoguchi-drag-item span {
            font-size: 10px;
            color: #c0392b;
            font-weight: bold;
        }
        .tsuyoguchi-triangle-icon {
            display: block;
        }

        /* 通用口マーカー（SVGで塗りつぶしなし黒三角を描画） */
        /* 外周セルへの入口ドラッグ中ハイライト */
        .grid-item.entrance-hint {
            background: rgba(231, 76, 60, 0.15) !important;
            outline: 2px dashed #e74c3c !important;
        }

        .tsuyoguchi-marker {
            position: absolute;
            z-index: 31;
            display: block;
            opacity: 0;
            cursor: pointer;
            pointer-events: auto;
        }
        .tsuyoguchi-marker svg polygon {
            fill: rgba(231, 76, 60, 0.45);
            stroke: rgba(231, 76, 60, 0.7);
            stroke-width: 1.5;
        }
        .tsuyoguchi-marker.drag-hint {
            opacity: 0.45;
        }
        .tsuyoguchi-marker.active {
            opacity: 1;
            cursor: pointer;
        }
        .tsuyoguchi-marker.active svg polygon {
            fill: #fff;
            stroke: #000;
            stroke-width: 2;
        }

        /* 主出入り口マーカー（塗りつぶし黒三角） */
        .shunyuriguchi-marker {
            position: absolute;
            width: 28px;
            height: 28px;
            z-index: 31;
            display: block;
            opacity: 0;
            cursor: copy;
            pointer-events: auto;
            background: none;
        }
        .shunyuriguchi-marker.drag-hint {
            opacity: 0.4;
        }
        .shunyuriguchi-marker.drag-over {
            opacity: 0.8;
        }
        .shunyuriguchi-marker.active {
            opacity: 1;
            cursor: pointer;
        }

        /* 新しく追加するプルダウンメニューのスタイル */
        .grid-settings {
            margin-top: 20px; /* グリッドからの余白を設定 */
            text-align: center; /* 中央揃え */
        }

        .block.placed {
            border: 2px solid black !important;
            margin-right: 0px;
            
        }

        .grid-settings label {
            margin-right: 10px;
            font-size: 16px;
            color: #333;
        }

        .grid-settings select {
            padding: 5px 10px;
            font-size: 16px;
            border-radius: 4px;
            border: none;
            outline: none;
            
        }

        /* small ブロックの回転ボタンを非表示 */
        .block-wrapper.small .rotate-button {
            display: none;
        }

        /* 小ブロックの基本スタイル（既定は左寄せ） */
        .block.small {
            width: 13px;
            height: 25px;
            background-color: #33ff4e;
            border: 2px solid black;
            margin-right: 10px;
            /* ※ブロック特有のデザインプロパティをここに記述 */
        }

        .block-position {
            position: absolute;
            top: 0;  /* 必要なら top も指定 */
        }
        
        
        /* 左寄せ用のクラス */
        .placed-left {
            position: absolute;
            left: 0;
            border: 2px solid black;
        }
        
        /* 右寄せ用のクラス */
        .placed-right {
            position: absolute;
            /* left: -1px !important; */
            right: 0px !important;
            /* left: auto !important; */
            transform:translateX(50%)
            
        }
        
        .placed-top {
        position: absolute;
        top: 0 !important;      /* 真上に配置 */
        left: auto !important;
        border: 2px solid black;
        z-index: 1;
    /* transform: translateY(-50%); 削除する */
}

   /* 回転している small block の下寄せ用クラス */
        .placed-bottom {
        top: 25px !important;
        left: auto !important;
        z-index: 1;
        border: 2px solid black;
        /* transform: translateY(50%); */
         }    
   
        
/* 画面下部に固定表示するフォーム全体のコンテナ */
.form-container {
    position: absolute;
    right: 0;
    display: flex;
    flex-direction: column;
    text-align: center;
}

/* フォーム内容そのもののスタイル（縦配列に変更） */
#board-size-form {
    display: inline-flex;
    flex-direction: column; /* 横並びから縦並びに変更 */
    align-items: center;
    gap: 10px;
    font-size: 14px;
    margin-right: 50px;
}

/* ボタンのスタイル */
#board-size-form button {
    width: 100px;
    height: 40px;
    font-size: 18px;
    border: none;
    background-color: #f0f0f0;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#board-size-form button:hover {
    background-color: #e0e0e0;
}

/* ラベルのスタイル */
#board-size-form label {
    font-size: 16px;
    margin: 0 5px;
}

/* 入力欄のスタイル */
#board-size-form input[type="number"] {
    width: 40px;
    height: 30px;
    font-size: 18px;
    padding: 4px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* 追加するCSSルール例 */
   
/* 衝突テストのための明示的な .road-marker スタイル（仮のデバッグ用スタイル） */
.road-marker {
    position: absolute;
    z-index: 1; /* プルダウンメニューより下に表示 */
    width: 20px;   /* 一時的に明示的な幅を設定 */
    height: 20px;  /* 一時的に明示的な高さを設定 */
    background-color: red; /* 目立つ色に設定 */
    pointer-events: none; /* マウスイベントを無効化 */
}
        

/* Update the CSS for .row-pulldown-container to ensure visibility */
.row-pulldown-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10000; /* Ensure it appears above other elements including road markers */
    background-color: transparent; /* 背景を透明に変更 */
    border: none; /* 外形の枠を非表示 */
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-radius: 4px;
    box-shadow: none; /* 影も非表示 */
}

.row-pulldown-select {
    width: 100%;
    border: none;
    /* border-left: 1px solid #000; 左側の線のみ表示 */
    background: transparent !important;
    font-size: 14px;
    padding: 2px;
    outline: none;
    appearance: none;
    text-align: center;
}

.pulldown-select {
    width: 100%;
    /* box-sizing: border-box; */
    border: none;               /* 全体の枠線を非表示 */
    background: transparent !important;
    font-size: 14px;
    padding: 2px;
    outline: none;
    appearance: none;
    text-align: center;
    text-align-last: center;
    /* justify-content: center; */
    /* align-items: center; */
}

/* Adding styles for grid-wrapper-container and row-spinner for row spinner controls */

/* プルダウンメニューの背景を確実に透明にする */
.row-pulldown-container,
.row-pulldown-container *,
.row-pulldown-select,
.pulldown-select {
    background-color: transparent !important;
    background: transparent !important;
}

/* select要素のデフォルトスタイルをリセット */
.row-pulldown-select,
.pulldown-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: transparent !important;
    background-color: transparent !important;
}

/* より強力な背景透明化ルール */
.row-pulldown-container,
.row-pulldown-container *,
.row-pulldown-select,
.pulldown-select,
.row-pulldown-select *,
.pulldown-select * {
    background-color: transparent !important;
    background: transparent !important;
    background-image: none !important;
}

/* ブラウザ固有のスタイルをリセット */
.row-pulldown-select,
.pulldown-select {
    -webkit-background-clip: padding-box;
    -moz-background-clip: padding-box;
    background-clip: padding-box;
    background-color: transparent !important;
    background: transparent !important;
}

/* 最終的な背景透明化ルール */
.row-pulldown-container,
.row-pulldown-container *,
.row-pulldown-select,
.pulldown-select,
.row-pulldown-select *,
.pulldown-select *,
.row-pulldown-container select,
.pulldown-container select {
    background-color: transparent !important;
    background: transparent !important;
    background-image: none !important;
    -webkit-background-clip: padding-box !important;
    -moz-background-clip: padding-box !important;
    background-clip: padding-box !important;
}

/* 面積表示用のスタイル */
.area-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    z-index: 20;
    pointer-events: none;
    white-space: nowrap;
}

.area-display.highlight {
    background-color: rgba(255, 0, 0, 0.8);
}

#netlify-identity-widget {
    z-index: 100000 !important;
    position: fixed !important;
}