        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            user-select: none;
            -webkit-user-select: none;
        }
        body {
            font-family: sans-serif;
            background-color: #333;
            color: #fff;
            display: flex;
            flex-direction: column;
            height: 100vh;
            overflow: hidden;
            /* アプリ全体としての限界最小幅。これ以上狭めるとスクロールバーが出ます */
            min-width: 600px; 
        }
        
        /* 画面全体のレイアウト */
        #main-container {
            flex: 1;
            display: flex;
            flex-direction: row;
            overflow: hidden;
            width: 100%;
        }

/* 左側ツールバーの2列化設定 */
#toolbar {
    background-color: #1e1e1e;
    width: 200px;
    min-width: 150px;
    padding: 10px 5px;
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2列 */
    gap: 6px;
    border-right: 1px solid #444;
    overflow-y: auto;
    align-content: start;
}
        
        .tool-group-title {
    grid-column: span 2; /* タイトルは2列分占有 */
    font-size: 11px;
    color: #aaa;
    text-align: center;
    margin-bottom: 2px;
}

.tool-group {
    grid-column: span 2; /* グループタイトルは2列分 */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 10px;
}

/* ボタンサイズを2列用に最適化 */
button {
    padding: 6px 2px;
    font-size: 11px;
    white-space: nowrap;
}

        .tool-group:last-of-type {
            border-bottom: none;
        }

.tool-group-title {
    grid-column: span 2;
    font-size: 11px;
    color: #aaa;
    text-align: center;
    margin-bottom: 2px;
    font-weight: bold;
}

        /* 各種ボタンの基本設定 */
        button, input[type="color"] {
            background-color: #555;
            color: white;
            border: 1px solid #777;
            padding: 10px 6px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            width: 100%;
            text-align: center;
            white-space: nowrap;
        }
        button.active {
            background-color: #007acc;
            border-color: #0098ff;
        }
        .history-btn {
            background-color: #444;
            border-color: #666;
        }
        .layer-btn {
            background-color: #444;
            padding: 8px 4px;
            font-size: 12px;
        }

        /* 【中央】キャンバスエリア（★ここがブラウザ幅に合わせて伸縮します） */
        #center-area {
            flex: 1; /* 残りの幅をすべて埋める */
            display: flex;
            flex-direction: column;
            background-color: #2b2b2b;
            position: relative;
            min-width: 300px; /* キャンバスの最低限の幅を保証 */
            overflow: hidden;
            /* ★お絵描きやピンチズームを行う中央エリアだけ、ブラウザ自体のスクロールを禁止 */
            touch-action: none;
        }

        /* 上部サブツールバー */
        #sub-toolbar {
            background-color: #252525;
            padding: 10px 15px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 15px;
            border-bottom: 2px solid #555;
            z-index: 10;
            /* サブツールバーの中身が溢れないよう、狭くなったら自動で折り返しを許可 */
            flex-wrap: wrap; 
        }
        .slider-container {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 1;
            min-width: 200px;
            max-width: 450px;
        }
        .slider-container label {
            font-size: 13px;
            min-width: 75px;
        }
        
        /* スライダー全体のデザイン */
        input[type="range"] {
            flex: 1;
            height: 10px;
            border-radius: 5px;
            background: #1a1a1a;
            border: 1px solid #444;
            outline: none;
            -webkit-appearance: none;
        }
        
        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background: #777;
            border: 2px solid #aaa;
            cursor: pointer;
        }
        input[type="range"]::-moz-range-thumb {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: #777;
            border: 2px solid #aaa;
            cursor: pointer;
        }

        .quick-size-btn {
            width: auto;
            padding: 4px 8px;
            font-size: 11px;
            background-color: #444;
        }

        /* 右側グループ（カラーピッカー、ボタン、右上送信ボタン） */
        .right-controls {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
        }

        /* 💻 【追加】接続先IPアドレス入力ボックスのスタイル */
        .ip-input-box {
            background-color: #1a1a1a;
            color: #00ffcc;
            border: 1px solid #555;
            padding: 8px 10px;
            border-radius: 6px;
            font-size: 13px;
            font-family: monospace;
            width: 130px;
            text-align: center;
        }
        .ip-input-box::placeholder {
            color: #666;
        }

        /* 右上専用のGIMP送信ボタン */
        #btn-submit {
            background-color: #28a745;
            border-color: #1e7e34;
            font-weight: bold;
            font-size: 14px;
            padding: 8px 16px;
            width: auto;
            box-shadow: 0 2px 4px rgba(0,0,0,0.3);
        }

        /* キャンバス表示領域 */
        #canvas-container {
            flex: 1;
            position: relative;
            background-image: 
                linear-gradient(45deg, #444 25%, transparent 25%), 
                linear-gradient(-45deg, #444 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #444 75%), 
                linear-gradient(-45deg, transparent 75%, #444 75%);
            background-size: 20px 20px;
            background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
            overflow: hidden;
            touch-action: none;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        canvas {
            display: block;
        }

        /* 【右側】Google広告専用の固定枠（幅160pxで常に完全固定） */
        #sidebar-ad {
            width: 160px;
            min-width: 160px;
            max-width: 160px;
            background-color: #222;
            border-left: 1px solid #444;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            padding: 10px 0;
            z-index: 10;
        }
        .ad-label {
            font-size: 10px;
            color: #666;
            margin-bottom: 5px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        .ad-slot {
            width: 160px;
            height: 600px;
            background-color: #111;
            border: 1px dashed #444;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #555;
            font-size: 12px;
            text-align: center;
        }

        #top-header {
    background-color: #222;
    padding: 12px 20px; /* 少しゆとりを持たせます */
    border-bottom: 2px solid #444;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 左寄せ */
    z-index: 100;
}