/* ─── フォロワー分類表 ─── */

.fm-container {
    max-width: 960px;
}

.fm-intro {
    margin-bottom: 1rem;
}

/* ─── コントロール ─── */
.fm-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 1rem;
}


.fm-controls .tag-btn {
    min-height: 42px;
    border-width: 1.5px;
    border-radius: 12px;
    padding: 0.55rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
}

.fm-controls .tag-btn.is-busy {
    opacity: 0.72;
    pointer-events: none;
}

/* ─── キャプチャエリア ─── */
.fm-capture-area {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.fm-capture-title {
    margin: 0;
    color: #111;
    font-size: clamp(1.3rem, 3vw, 1.85rem);
    font-weight: 800;
    text-align: center;
    word-break: break-word;
    white-space: pre-wrap;
}

/* ─── グリッドスクロールラッパー ─── */
.fm-grid-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ─── グリッド ─── */
.fm-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border: 4px solid #111;
    width: 100%;
    min-width: 600px;
}

.fm-cell {
    border: 2px solid #111;
    min-height: 206px;
    min-width: 0;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
}

/* ─── セルラベル行 ─── */
.fm-cell-label-row {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 4px;
    flex-shrink: 0;
    min-width: 0;
    width: 100%;
    transition: border-bottom-color 0.12s;
}

.fm-cell-label-row:focus-within {
    border-bottom-color: rgba(0, 0, 0, 0.28);
}

.fm-cell-label {
    display: block;
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 700;
    color: #111;
    padding: 0;
    margin: 0;
    font-family: inherit;
    cursor: text;
    outline: none;
    line-height: 1.3;
    resize: none;
    overflow: hidden;
    text-align: center;
}

.fm-cell-label:focus {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 3px 3px 0 0;
    padding: 0 3px;
}

.fm-cell-label-icon {
    flex-shrink: 0;
    font-size: 0.58rem;
    color: rgba(0, 0, 0, 0.26);
    cursor: pointer;
    pointer-events: auto;
    transition: color 0.12s;
}

.fm-cell-label-row:focus-within .fm-cell-label-icon,
.fm-cell-label-icon:hover {
    color: rgba(0, 0, 0, 0.52);
}

/* ─── ユーザーエリア ─── */
.fm-cell-users {
    display: grid;
    grid-template-columns: repeat(3, 40px);
    gap: 6px;
    align-content: start;
}

.fm-user-wrap {
    position: relative;
    flex-shrink: 0;
}

.fm-user-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 1.5px solid rgba(148, 163, 184, 0.7);
    background: #f0f0f0;
}

.fm-user-del {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.92);
    color: #fff;
    border: 2px solid #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.fm-user-wrap:hover .fm-user-del,
.fm-user-wrap:focus-within .fm-user-del {
    display: flex;
}

@media (hover: none) {
    .fm-user-del {
        display: flex;
    }
}

/* ─── 追加ボタン ─── */
.fm-cell-add {
    align-self: flex-start;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px dashed var(--teal-mid);
    background: transparent;
    color: var(--teal-mid);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    margin-top: 2px;
}

.fm-cell-add:hover {
    background: var(--teal-mid);
    color: #fff;
    border-style: solid;
}

/* ─── エクスポートモード ─── */
.fm-capture-area.is-exporting {
    padding: 20px;
    border-radius: 0;
    box-shadow: none;
    align-items: center;
    /* スマホでも常にPC幅で出力 */
    width: 900px !important;
    max-width: none !important;
    min-width: 0 !important;
}

/* デバイス問わず常にPC用レイアウトで出力 */
.fm-capture-area.is-exporting .fm-grid-scroll {
    overflow: visible;
    width: 100% !important;
}

.fm-capture-area.is-exporting .fm-grid {
    grid-template-columns: repeat(5, 1fr) !important;
    min-width: 0 !important;
    width: 100% !important;
}

.fm-capture-area.is-exporting .fm-cell {
    min-height: 178px;
    padding: 8px 8px 10px !important;
    gap: 6px !important;
}

.fm-capture-area.is-exporting .fm-cell-users {
    grid-template-columns: repeat(3, 40px) !important;
    gap: 6px !important;
}

.fm-capture-area.is-exporting .fm-user-img {
    width: 40px !important;
    height: 40px !important;
}

.fm-capture-area.is-exporting .fm-cell-label-row {
    border-bottom-color: rgba(0, 0, 0, 0.1) !important;
}

.fm-capture-area.is-exporting .fm-cell-label {
    pointer-events: none;
    font-size: 0.95rem !important;
    white-space: pre-wrap !important;
    word-break: break-all !important;
    overflow: visible !important;
    height: auto !important;
}

.fm-capture-area.is-exporting .fm-cell-label-icon {
    display: none !important;
}

.fm-capture-area.is-exporting .fm-cell-add,
.fm-capture-area.is-exporting .fm-user-del {
    display: none !important;
}

.fm-capture-area.is-exporting .fm-capture-title {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

/* ─── Xユーザー検索モーダル (tier-page.css と共通デザイン) ─── */
.fm-x-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.fm-x-modal.is-open {
    display: flex;
}

.fm-x-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 32, 40, 0.28);
}

.fm-x-modal__panel {
    position: relative;
    width: min(430px, calc(100vw - 2rem));
    padding: 10px;
    border: 1px solid rgba(156, 199, 191, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 22px 56px rgba(0, 32, 40, 0.24);
}

.fm-x-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(156, 199, 191, 0.4);
}

.fm-x-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fm-x-input {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-width: 0;
    height: 44px;
    border: 1px solid var(--teal-mid);
    border-radius: 8px;
    margin: 0;
    padding: 0 14px;
    background: #fff;
    color: var(--text-dark);
    font: inherit;
    font-size: 0.9rem;
}

.fm-x-input:focus {
    outline: none;
    border-color: var(--teal-mid);
    box-shadow: 0 0 0 2px rgba(0, 121, 107, 0.14);
}

.fm-x-search {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    min-width: 78px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0;
    margin: 0;
    background: var(--teal-mid);
    color: #fff;
    font: inherit;
    font-size: 1.05rem;
    cursor: pointer;
}

.fm-x-search:hover {
    background: var(--teal-dark);
}

.fm-x-hint {
    padding: 0 0.2rem;
    color: var(--text-light);
    font-size: 0.74rem;
    line-height: 1.35;
}

.fm-x-hint-break {
    display: none;
}

@media (max-width: 560px) {
    .fm-x-hint-break {
        display: block;
    }
}

.fm-x-candidates {
    display: grid;
    gap: 0.25rem;
    margin-top: 8px;
}

.fm-x-candidate {
    width: 100%;
    min-height: 38px;
    border: 0;
    border-radius: 7px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.55rem;
    background: #eef7f5;
    color: var(--text-dark);
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
}

.fm-x-candidate img {
    box-sizing: border-box;
    width: 24px;
    height: 24px;
    padding: 3px;
    border-radius: 50%;
    object-fit: contain;
    flex: 0 0 24px;
}

/* ─── 画像アップロード（鍵垢用） ─── */
.fm-x-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}

.fm-x-local-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.fm-x-local-pick {
    height: 36px;
    border-radius: 7px;
    border: 1.5px dashed var(--teal-mid);
    background: transparent;
    color: var(--teal-mid);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.fm-x-local-pick:hover {
    background: rgba(0, 121, 107, 0.07);
}

.fm-x-local-file {
    display: none;
}


.fm-x-note {
    border-top: 1px solid rgba(156, 199, 191, 0.55);
    margin-top: 0.15rem;
    padding: 0.45rem 0.2rem 0.05rem;
    color: var(--text-light);
    font-size: 0.74rem;
    line-height: 1.35;
}

/* ─── モバイル ─── */
@media (max-width: 640px) {
    .fm-controls {
        justify-content: flex-start;
    }

    .fm-grid-scroll {
        overflow-x: visible;
    }

    .fm-grid {
        grid-template-columns: repeat(2, 1fr);
        min-width: 0;
    }

    .fm-capture-title {
        font-size: 1.1rem;
    }

    .fm-cell {
        min-height: 160px;
        padding: 5px;
        gap: 4px;
    }

    .fm-cell-label {
        font-size: 0.82rem;
    }

    .fm-cell-users {
        grid-template-columns: repeat(3, 36px);
        gap: 4px;
    }

    .fm-user-img {
        width: 36px;
        height: 36px;
    }

    .fm-cell-add {
        width: 22px;
        height: 22px;
        font-size: 0.95rem;
    }
}
