/* 画像結合 */

#app-collage {
    max-width: 960px;
}

/* ---------- 入力口（DESIGN.md 5.5） ---------- */
#app-collage .cl-drop {
    background-color: var(--bs-body-bg);
    border: 2px dashed var(--bs-border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease;
}

#app-collage .cl-drop:hover,
#app-collage .cl-drop:focus-visible,
#app-collage .cl-drop.drag-over {
    border-color: var(--bs-primary);
    background-color: var(--bs-primary-bg-subtle);
    outline: none;
}

#app-collage .cl-drop-icon {
    font-size: 2.6rem;
    color: var(--bs-primary);
}

#app-collage .drop-zone-mini {
    display: flex;
    background-color: var(--bs-body-bg);
    border: 2px dashed var(--bs-border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease;
}

#app-collage .drop-zone-mini:hover,
#app-collage .drop-zone-mini:focus-visible,
#app-collage .drop-zone-mini.drag-over {
    border-color: var(--bs-primary);
    background-color: var(--bs-primary-bg-subtle);
    outline: none;
}

#app-collage .drop-zone-mini-icon {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}

/* ---------- パネル ---------- */
#app-collage .cl-panel {
    border: 1px solid var(--bs-border-color);
    border-radius: 4px;
    overflow: hidden;
    background: var(--bs-body-bg);
}

#app-collage .cl-panel-head {
    background: var(--bs-tertiary-bg);
    border-bottom: 1px solid var(--bs-border-color);
    padding: .55rem 1rem;
    font-weight: 700;
}

#app-collage .cl-panel-body {
    padding: 1rem;
}

/* ---------- サムネイル（折り返しグリッド） ---------- */
#app-collage .cl-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: .5rem;
}

@media (max-width: 575.98px) {
    #app-collage .cl-thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

#app-collage .cl-thumb {
    position: relative;
    aspect-ratio: 1;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    cursor: grab;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#app-collage .cl-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

#app-collage .cl-thumb-ghost {
    opacity: .35;
}

#app-collage .cl-thumb-no {
    position: absolute;
    left: 0;
    top: 0;
    min-width: 1.6rem;
    padding: 0 .3rem;
    font-size: .8rem;
    font-weight: 700;
    text-align: center;
    background: var(--bs-dark);
    color: #fff;
}

#app-collage .cl-thumb-handle {
    position: absolute;
    left: 0;
    bottom: 0;
    color: var(--bs-secondary-color);
    background: var(--bs-body-bg);
    line-height: 1;
    padding: 2px;
}

#app-collage .cl-thumb-del {
    position: absolute;
    right: 0;
    top: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bs-body-bg);
    border-radius: 0;
}

#app-collage .cl-thumb-del:hover {
    background: var(--bs-danger);
}

/* ---------- 設定 ---------- */
#app-collage .cl-opts {
    display: grid;
    gap: .4rem;
}

#app-collage .cl-opts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#app-collage .cl-opts-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

#app-collage .cl-opts .btn {
    white-space: nowrap;
    padding-inline: .2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#app-collage .cl-row {
    display: grid;
    grid-template-columns: 3.5em 1fr;
    align-items: center;
    gap: .5rem;
    margin-bottom: .75rem;
}

#app-collage .cl-row-top { align-items: start; }
#app-collage .cl-row-top .cl-label { padding-top: .45rem; }

/* 最大幅のプリセット: 数字と用途の2段。スマホは 3×2、広い画面は6つ横並び */
#app-collage .cl-opts-w { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 768px) { #app-collage .cl-opts-w { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
#app-collage .cl-opts .cl-opt-w { flex-direction: column; line-height: 1.2; padding-block: .3rem; font-variant-numeric: tabular-nums; }
#app-collage .cl-opt-w small { font-size: .72rem; opacity: .8; }
#app-collage .cl-maxw-custom { max-width: 12rem; }

#app-collage .cl-label {
    font-weight: 700;
    font-size: .9rem;
}

#app-collage .cl-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));   /* すき間・背景色（最大幅は下の行のプリセットへ移した） */
    gap: .75rem 1.25rem;
    align-items: end;
}

@media (max-width: 767.98px) {
    #app-collage .cl-settings { grid-template-columns: 1fr; }
}

@media (max-width: 575.98px) {
    #app-collage .cl-opts-3 .btn .mach-mi { display: none; }   /* 402px では字だけにして1行に収める */
}

/* ---------- プレビュー（透明がわかるように市松の地） ---------- */
#app-collage .cl-preview-wrap {
    padding: .5rem;
    display: flex;
    justify-content: center;
    background:
        repeating-conic-gradient(var(--bs-tertiary-bg) 0% 25%, var(--bs-body-bg) 0% 50%) 50% / 20px 20px;
}

#app-collage #cl-preview {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    display: block;
}
