:root {
    --bg-color: #f5f5f5;
    --panel-bg: #ffffff;
    --border-color: #ddd;
    --accent-color: #007acc;
    --text-color: #333;
}

body {
    margin: 0;
    font-family: sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.app-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ドロップゾーン */
.drop-zone {
    border: 2px dashed var(--border-color);
    background-color: var(--panel-bg);
    padding: 3rem;
    text-align: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.drop-zone.dragover {
    border-color: var(--accent-color);
    background-color: #e6f7ff;
}

/* ギャラリー */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.gallery img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* ボタン類 */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background-color: #e0e0e0;
}

.primary-btn {
    background-color: var(--accent-color);
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 0.8rem 2rem;
}

.primary-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* キャンバス */
#result-canvas {
    max-width: 100%;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-height: 300px;
}

/* ギャラリーとサムネイルのコンテナ */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.thumb-container {
    position: relative;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid var(--accent-color); /* 選択中の枠線 */
    transition: all 0.2s;
}

.thumb-container img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
}

/* スキップ（除外）状態のオーバーレイ */
.exclude-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
}

/* 除外された際のデザイン変化 */
.thumb-container.excluded {
    border-color: #999;
    opacity: 0.5;
}

.thumb-container.excluded .exclude-overlay {
    opacity: 1; /* スキップ文字を表示 */
}

/* アクションボタンのコンテナ */
.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

/* クリアボタン (危険な操作) */
.danger-btn {
    background-color: #ff4d4f;
    color: white;
}

.danger-btn:disabled {
    background-color: #f5f5f5;
    color: #ccc;
    cursor: not-allowed;
    border: 1px solid #ddd;
}



/* ==========================================
   レイアウトの基本設定 (HTMLのインラインから移動)
   ========================================== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

/* 既存の .app-container を上書き */
.app-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

/* ==========================================
   モバイル用警告メッセージ
   ========================================== */
.mobile-warning {
    display: none; /* デフォルト（PC）では非表示 */
    background-color: #fff3cd;
    color: #856404;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #ffeeba;
    grid-column: 1 / -1; /* グリッドの全幅を使用 */
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;
}

/* ==========================================
   レスポンシブ対応 (画面幅768px以下のスマートフォン等)
   ========================================== */
@media (max-width: 768px) {
    /* 2カラムを縦1列の積み重ねに変更 */
    .app-container {
        grid-template-columns: 1fr; 
    }

    /* ヘッダーの要素がはみ出さないように縦並びに折り返す */
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .app-header > div:last-child {
        width: 100%;
        justify-content: space-between;
    }
}




/* デバッグパネル  ========================================*/
.debug-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 40vh;
    background-color: rgba(30, 30, 30, 0.95);
    color: #00ff00; /* ターミナル風の緑 */
    border-top: 2px solid #555;
    z-index: 9999;
    padding: 1rem;
    overflow-y: auto;
    font-family: monospace;
    transition: transform 0.3s ease;
}

.debug-panel.hidden {
    transform: translateY(100%);
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.debug-gallery {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.debug-item {
    min-width: 200px;
    background: #000;
    border: 1px solid #444;
    padding: 0.5rem;
}

.debug-item canvas {
    width: 100%;
    height: auto;
    background: #333;
}