/**
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * ⚡ APC System - Main Stylesheet
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * 📁 파일명: /www/_acc/css/style.css
 * 📌 버전: v3.12
 * 📅 작성일: 2025-12-15
 * 📝 설명: ⭐ 모달 이미지 편집 영역(edit-image-section) 스타일 추가
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 */

:root {
    --primary: #FF6B35;
    --primary-hover: #E85A2A;
    --bg: #fffbeb;
    --surface: #ffffff;
    --text: #1f2937;
    --border: #e5e7eb;
    --accent: #f59e0b;
}

body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ★★★ Sticky Header Wrapper (헤더 + 필터바 통합 고정) ★★★ */
.sticky-header-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);             /* ⭐ 배경색 (필터바 영역) */
}

/* ★★★ Sticky Header ★★★ */
.sticky-header {
    background: linear-gradient(135deg, #f59e0b 0%, #FF6B35 50%, #E91E63 100%);
    color: white;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 0;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.header-center {
    text-align: center;
}

.sticky-header h1 {
    font-size: 1.8em;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.sticky-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9em;
}

/* ★★★ 언어 드롭다운 - 항상 우측 상단 ★★★ */
.lang-dropdown {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lang-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.3);
}

.lang-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    min-width: 140px;
}

.lang-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: block;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.lang-option:hover {
    background: #fef3c7;
}

.lang-option.active {
    background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
    color: #FF6B35;
    font-weight: 600;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* --- Gallery Grid --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    padding-bottom: 60px;
}

/* --- Card Design --- */
.gallery-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #fde68a;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(255, 107, 53, 0.15);
}

.card-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(135deg, #fff7ed 0%, #fffbeb 100%);
    gap: 10px;
    /* ★ border-bottom 제거 */
}

/* ★★★ 프로필 사진 ★★★ */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #fde68a;
    background: #f0f0f0;
    transition: transform 0.2s, border-color 0.2s;
}

.user-avatar:hover {
    transform: scale(1.1);
    border-color: #FF6B35;
}

.user-avatar.loaded {
    border-color: #fde68a;
}

.user-link {
    font-weight: 700; 
    font-size: 0.9rem; 
    color: #FF6B35;
    text-decoration: none;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-link:hover { 
    text-decoration: underline; 
    color: #E91E63;
}

.x-link {
    color: #000; opacity: 0.6; transition: opacity 0.2s; display: flex; align-items: center;
    flex-shrink: 0;
}
.x-link:hover { opacity: 1; }

/* ★★★ 이미지 Wrapper (여백 적용) ★★★ */
.card-image-wrapper {
    padding: 12px;
    background: #fffbeb;
}

.card-image {
    width: 100%; 
    aspect-ratio: 4 / 5; 
    background: #f0f0f0; 
    cursor: pointer; 
    position: relative; 
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.card-image img {
    width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s;
    border-radius: 12px;
}
.card-image:hover img { transform: scale(1.05); }

.card-footer {
    padding: 10px 14px; 
    background: #fffbeb;
    display: flex; 
    align-items: center;
    /* ★ border-top 제거 */
}

.badge {
    background: #fef3c7;
    color: #d97706;
    font-size: 0.75rem; font-weight: 600; padding: 4px 8px; border-radius: 4px; text-transform: uppercase;
    border: 1px solid #fde68a;
}

/* ★★★ Filter Bar - 가로 스크롤 (스크롤바 숨김) ★★★ */
h1 { margin-top: 0; }

.filter-bar { 
    margin: 0;                          /* ⭐ 상하 여백 제거 (wrapper 내부) */
    padding: 15px 20px;                 /* ⭐ 상하좌우 여백 */
    display: flex; 
    flex-wrap: nowrap;                  /* ⭐ 한 줄 고정 */
    gap: 12px;
    background: var(--bg);              /* ⭐ 배경색 */
    border-bottom: 1px solid #fde68a;   /* ⭐ 하단 구분선 */
    align-items: center;
}

.filter-buttons {
    flex: 1;                            /* ⭐ 남은 공간 차지 */
    min-width: 0;                       /* ⭐ flex 아이템 축소 허용 */
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    user-select: none;                  /* ⭐ 드래그 시 텍스트 선택 방지 */
}

.filter-buttons::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    height: 38px;
    padding: 0 18px; 
    border-radius: 19px; 
    border: 1px solid #fde68a; 
    background: white; 
    color: #92400e; 
    text-decoration: none; 
    font-size: 0.9rem;
    line-height: 36px;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.filter-btn:hover {
    background: #fef3c7;
}
.filter-btn.active { 
    background: linear-gradient(135deg, #f59e0b 0%, #FF6B35 100%);
    color: white; 
    border-color: #FF6B35; 
}

/* ★★★ 검색 + 결과 수 (한 행) ★★★ */
.search-result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* 결과 수 표시 */
.result-count {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: white;
    height: 38px;
    padding: 0 18px;
    border-radius: 19px;
    border: 1px solid #fde68a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.count-number {
    font-size: 1.1rem;
    font-weight: 800;
    color: #FF6B35;
}

.count-label {
    font-size: 0.85rem;
    color: #92400e;
    font-weight: 600;
}

/* ★★★ 검색 폼 ★★★ */
.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    height: 38px;
    padding: 0 4px 0 14px;
    border-radius: 19px;
    border: 1px solid #fde68a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.search-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9rem;
    width: 150px;
    color: #1f2937;
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-btn {
    background: var(--primary);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.search-btn:hover {
    background: var(--primary-hover);
}

.search-btn svg {
    stroke: white;
}

.search-clear {
    color: #9ca3af;
    text-decoration: none;
    font-size: 1rem;
    padding: 4px 8px;
    cursor: pointer;
    transition: color 0.2s;
}

.search-clear:hover {
    color: #ef4444;
}

/* 카드 타이틀 */
.card-title {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: #fffbeb;
    /* ★ border-top 제거 */
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * ★★★ MODAL - 이미지 고정 크기 ★★★
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.modal-overlay {
    display: none;
    position: fixed; 
    z-index: 9999;
    top: 0; left: 0; 
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    justify-content: center; 
    align-items: center;
    padding: 40px; 
    box-sizing: border-box;
    backdrop-filter: blur(5px);
}
.modal-overlay.active { display: flex; }

.modal-content {
    background: #ffffff;  /* ★ 흰색 배경 */
    width: 100%; 
    max-width: 1100px; 
    max-height: 90vh;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* ★★★ 데스크톱 레이아웃: 이미지 고정 크기 + 팝업 유동 높이 ★★★ */
.modal-body { 
    display: grid;
    grid-template-columns: 460px 1fr;  /* ⭐ 이미지 영역 460px 고정 */
    height: auto;                      /* ⭐ 유동 높이 */
    max-height: 90vh;
}

/* ★ 왼쪽: 이미지 영역 (modal-left) - ⭐ 고정 크기 */
.modal-left {
    width: 460px;                      /* ⭐ 고정 너비 (400 + padding 60) */
    min-width: 460px;                  /* ⭐ 최소 너비 (이미지 없어도 유지) */
    flex-shrink: 0;                    /* ⭐ 축소 방지 */
    background: var(--bg);             /* ⭐ 메인 배경색 (#fffbeb) */
    display: flex;
    flex-direction: column;            /* ⭐ 이미지 + 편집 영역 세로 배치 */
    align-items: center;
    justify-content: flex-start;       /* ⭐ 상단 정렬 */
    padding: 30px;                     /* ⭐ 여백 (이미지 주변) */
    box-sizing: border-box;
    overflow-y: auto;                  /* ⭐ 세로 스크롤 허용 */
}

.img-container { 
    width: 400px;                      /* ⭐ 고정 너비 */
    height: 600px;                     /* ⭐ 고정 높이 */
    min-width: 400px;                  /* ⭐ 최소 너비 (이미지 없어도 유지) */
    min-height: 600px;                 /* ⭐ 최소 높이 (이미지 없어도 유지) */
    flex-shrink: 0;                    /* ⭐ 크기 고정 유지 */
    display: flex; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden;
    border-radius: 12px;
    background: #f0f0f0;               /* ⭐ 로딩 시 배경색 */
}

.img-container img { 
    width: 100%;
    height: 100%;
    object-fit: cover;                 /* ⭐ 꽉 채우기 (비율 유지, 잘림) */
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

/* ★★★ 이미지 편집 영역 (edit-image-section) ★★★ */
.edit-image-section {
    display: flex;
    flex-direction: row;               /* ⭐ 데스크톱: 가로 배치 */
    gap: 8px;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: #fef3c7;
    border-radius: 8px;
    align-items: center;
    box-sizing: border-box;
}

.edit-image-section .edit-input {
    flex: 1;
    margin-top: 0;                     /* ⭐ 기존 edit-input margin 오버라이드 */
    min-width: 0;                      /* ⭐ flex 아이템 축소 허용 */
}

.edit-image-section .btn-sm {
    flex-shrink: 0;
    padding: 8px 12px;
    white-space: nowrap;
    background: #d97706;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.edit-image-section .btn-sm:hover {
    background: #b45309;
}

/* ★ 오른쪽: Flexbox 컬럼 (modal-right) */
.modal-right {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg);             /* ⭐ 메인 배경색 (#fffbeb) */
}

/* ★ 헤더 영역 - 고정 (modal-right-header) */
.modal-right-header {
    flex-shrink: 0;
    padding: 25px 25px 15px 25px;
    border-bottom: 1px solid #fde68a;
    background: transparent;            /* ⭐ 투명 (부모 배경 사용) */
}

/* ★ 프롬프트 영역 - ⭐ 높이 제한 + 스크롤 (modal-right-body) */
.modal-right-body {
    flex: 0 0 auto;                    /* ⭐ 늘어나지 않음 */
    max-height: 40vh;                  /* ⭐ 뷰포트 40% 제한 */
    overflow-y: auto;
    padding: 15px 25px;
    display: flex;
    flex-direction: column;
    background: transparent;            /* ⭐ 투명 (부모 배경 사용) */
}

/* ★ 버튼 영역 - 하단 고정 (modal-right-footer) */
.modal-right-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 15px 25px;
    background: transparent;            /* ⭐ 투명 (부모 배경 사용) */
    border-top: 1px solid #fde68a;
}

/* --- 공통 요소 스타일 --- */

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #FF6B35;
    margin: 0 0 12px 0;
    line-height: 1.4;
    word-break: break-word;
}

.header-top-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* 관리 버튼 */
.admin-controls { 
    display: flex; 
    flex-direction: row;
    gap: 8px; 
}

.icon-btn {
    background: none; border: none; cursor: pointer;
    padding: 6px; border-radius: 50%;
    transition: background 0.2s; opacity: 0.5;
    color: #333;
}
.icon-btn:hover { opacity: 1; }
.delete-btn:hover { background: #fee2e2; color: #ef4444; }
.edit-btn:hover { background: #fef3c7; color: #d97706; }

.user-text h2 { 
    margin: 0; 
    font-size: 1.4rem; 
    color: #FF6B35;
}

/* Tags */
.tags-display-area {
    display: flex; 
    flex-direction: row;
    gap: 8px; 
    flex-wrap: wrap; 
    margin-top: 10px;
}

.tag-pill {
    padding: 5px 12px; border-radius: 20px;
    font-size: 0.8rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
}

.category-badge { 
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a; 
}

.hash-tag { 
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
    font-size: 0.85rem; 
    text-transform: none;
}

/* Edit Inputs */
.edit-select {
    padding: 8px 12px;
    border: 1px solid #fde68a;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.edit-select:focus {
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.edit-input {
    width: 100%; padding: 8px; margin-top: 10px;
    border: 1px solid #fde68a; border-radius: 6px;
    font-size: 0.9rem; font-family: monospace;
    box-sizing: border-box;
}
.edit-input:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.edit-textarea {
    width: 100%; height: 100%; min-height: 200px; padding: 10px;
    border: 1px solid #fde68a; border-radius: 6px;
    font-size: 0.95rem; font-family: monospace; line-height: 1.5;
    resize: none;
    box-sizing: border-box;
}
.edit-textarea:focus {
    outline: none;
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.save-btn { background: #10b981; color: white; }
.save-btn:hover { background: #059669; box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3); }

/* 프롬프트 영역 내부 */
.section-label { 
    display: block; 
    font-size: 0.8rem; 
    font-weight: 700; 
    color: #d97706;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.prompt-text-area {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px; 
    padding: 15px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.prompt-text-area p {
    margin: 0; 
    white-space: pre-wrap; 
    font-family: monospace; 
    font-size: 0.9rem; 
    line-height: 1.6; 
    color: #374151; 
    word-break: break-word;
}

/* 버튼 스타일 */
.action-btn {
    padding: 12px 20px; 
    border-radius: 10px; 
    font-weight: 600; 
    font-size: 0.95rem; 
    cursor: pointer; 
    border: none; 
    display: inline-flex;
    align-items: center; 
    justify-content: center; 
    gap: 6px; 
    transition: all 0.2s;
    white-space: nowrap;
}

.link-btn {
    background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb;
}
.link-btn:hover { background: #e5e7eb; color: #111; }

.copy-btn-main {
    background: linear-gradient(135deg, #f59e0b 0%, #FF6B35 100%);
    color: white;
}
.copy-btn-main:hover { 
    background: linear-gradient(135deg, #FF6B35 0%, #E91E63 100%);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3); 
}

/* ★★★ Scroll to Top Button ★★★ */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #f59e0b 0%, #FF6B35 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999;
}

.scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    background: linear-gradient(135deg, #FF6B35 0%, #E91E63 100%);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
    transform: translateY(-3px);
}

.scroll-top-btn svg {
    width: 24px;
    height: 24px;
    stroke: white;
    stroke-width: 2.5;
    fill: none;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * ★★★ MOBILE RESPONSIVE (max-width: 768px) ★★★
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 768px) {
    
    /* ★ 헤더 축소 */
    .sticky-header {
        padding: 12px 15px;
    }
    .sticky-header h1 {
        font-size: 1.1em;
    }
    .sticky-header p {
        font-size: 0.7em;
        margin-top: 4px;
    }
    
    /* ★ 언어 드롭다운 유지 */
    .header-content {
        padding-right: 70px;
    }
    .lang-dropdown {
        right: 10px;
    }
    .lang-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    /* ★ 컨테이너 */
    .container {
        padding: 12px;
    }
    
    /* ★ 필터바 - 모바일 (두 줄 레이아웃) */
    .filter-bar {
        padding: 10px 12px;
        gap: 10px;
        flex-wrap: wrap;                /* ⭐ 모바일은 줄바꿈 허용 */
    }
    .filter-buttons {
        gap: 8px;
        width: 100%;                    /* ⭐ 첫 번째 줄 전체 차지 */
        flex: none;
        order: 1;
    }
    .filter-btn {
        height: 32px;
        padding: 0 14px;
        font-size: 0.8rem;
        line-height: 30px;
        border-radius: 16px;
    }
    
    /* ★ 검색 + 결과 한 행 - 모바일 (두 번째 줄) */
    .search-result-row {
        gap: 8px;
        width: 100%;
        justify-content: space-between;
        order: 2;
    }
    
    /* ★ 결과 수 */
    .result-count {
        height: 32px;
        padding: 0 12px;
        border-radius: 16px;
    }
    .count-number {
        font-size: 1rem;
    }
    .count-label {
        font-size: 0.7rem;
    }
    
    /* ★ 검색 폼 - 모바일 */
    .search-form {
        height: 32px;
        padding: 0 3px 0 12px;
        flex: 1;
        max-width: none;
        border-radius: 16px;
    }
    .search-input {
        width: auto;
        flex: 1;
        min-width: 60px;
        font-size: 0.85rem;
    }
    .search-btn {
        width: 26px;
        height: 26px;
        flex-shrink: 0;
    }
    .search-btn svg {
        width: 14px;
        height: 14px;
    }
    
    /* ★ 카드 그리드 - 2열 */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    /* ★ 카드 축소 */
    .card-header {
        padding: 8px 10px;
        gap: 8px;
    }
    .user-avatar {
        width: 26px;
        height: 26px;
        border-width: 1.5px;
    }
    .user-link {
        font-size: 0.75rem;
    }
    
    /* ★ 이미지 wrapper 축소 */
    .card-image-wrapper {
        padding: 8px;
    }
    .card-image {
        border-radius: 8px;
    }
    .card-image img {
        border-radius: 8px;
    }
    
    .card-title {
        padding: 6px 10px;
        font-size: 12px;
    }
    .card-footer {
        padding: 6px 10px;
    }
    .badge {
        font-size: 0.65rem;
        padding: 3px 6px;
    }
    
    /* ★ Scroll to Top */
    .scroll-top-btn {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 20px;
    }
    .scroll-top-btn svg {
        width: 20px;
        height: 20px;
    }
    
    /* ★ 관리 버튼 숨김 (모바일) */
    .desktop-only {
        display: none !important;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * ★★★ MOBILE MODAL (max-width: 768px) ★★★
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 768px) {
    
    /* ★ 모달 오버레이 - 외부 클릭 여백 */
    .modal-overlay {
        padding: 12px;
    }
    
    /* ★ 모달 컨텐츠 - 자동 높이 */
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: calc(100vh - 24px);
        border-radius: 16px;
        overflow: hidden;
        background: #ffffff;
    }
    
    /* ★★★ 모바일 레이아웃: 이미지+정보 상단, 프롬프트+버튼 하단 ★★★ */
    .modal-body {
        display: grid;
        grid-template-columns: 140px 1fr;
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
            "image info"
            "prompt prompt"
            "footer footer";
        height: auto;
        max-height: calc(100vh - 24px);
        overflow: hidden;
    }
    
    /* ★ 이미지 영역 - 모바일 크기로 오버라이드 */
    .modal-left {
        grid-area: image;
        width: auto;                       /* ⭐ 데스크톱 460px 오버라이드 */
        min-width: auto;                   /* ⭐ 데스크톱 min-width 오버라이드 */
        padding: 12px;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        background: var(--bg);             /* ⭐ 메인 배경색 (#fffbeb) */
    }
    
    .img-container {
        width: 120px;                      /* ⭐ 모바일 고정 크기 */
        height: 160px;
        min-width: 120px;                  /* ⭐ 데스크톱 400px 오버라이드 */
        min-height: 160px;                 /* ⭐ 데스크톱 600px 오버라이드 */
        max-width: 120px;
        max-height: 160px;
        border-radius: 12px;
        overflow: hidden;
        flex-shrink: 0;
        background: #f0f0f0;
    }
    
    .img-container img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 12px;
    }
    
    /* ★ 정보 영역 (modal-right 무력화) */
    .modal-right {
        display: contents;
    }
    
    .modal-right-header {
        grid-area: info;
        padding: 12px;                     /* ⭐ 모든 방향 12px 여백 */
        border-bottom: none;
        overflow: visible;
        background: var(--bg);             /* ⭐ 메인 배경색 (#fffbeb) */
    }
    
    /* ⭐ 모바일에서 수정/삭제 버튼 숨김 */
    .admin-controls {
        display: none !important;
    }
    
    /* ⭐ 모바일에서 이미지 편집 영역 숨김 (편집 모드 비활성) */
    .edit-image-section {
        display: none !important;
    }
    
    .modal-title {
        font-size: 0.9rem;
        margin-bottom: 6px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .header-top-row {
        margin-bottom: 6px;
    }
    
    .category-badge {
        padding: 3px 8px;
        font-size: 0.65rem;
    }
    
    .user-text h2 {
        font-size: 0.85rem;
    }
    
    .tags-display-area {
        gap: 4px;
        margin-top: 6px;
    }
    
    .hash-tag {
        padding: 2px 6px;
        font-size: 0.65rem;
    }
    
    /* ★ 프롬프트 영역 - 전체 너비, 스크롤 */
    .modal-right-body {
        grid-area: prompt;
        flex: 0 0 auto;                    /* ⭐ 늘어나지 않음 */
        padding: 12px;
        border-top: 1px solid #fde68a;
        min-height: 100px;
        max-height: 40vh;                  /* ⭐ 뷰포트 40% 제한 */
        overflow-y: auto;
        background: var(--bg);             /* ⭐ 메인 배경색 (#fffbeb) */
    }
    
    .section-label {
        font-size: 0.7rem;
        margin-bottom: 8px;
    }
    
    .prompt-text-area {
        padding: 10px;
    }
    
    .prompt-text-area p {
        font-size: 0.8rem;
        line-height: 1.5;
    }
    
    /* ★ 버튼 영역 - 하단 고정 */
    .modal-right-footer {
        grid-area: footer;
        padding: 12px;
        gap: 8px;
        border-top: 1px solid #fde68a;
        background: var(--bg);             /* ⭐ 메인 배경색 (#fffbeb) */
    }
    
    .action-btn {
        flex: 1;
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    .action-btn svg {
        width: 16px;
        height: 16px;
    }
    
    #btnUserText {
        max-width: 70px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 * ★★★ VERY SMALL MOBILE (max-width: 400px) ★★★
 * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
@media (max-width: 400px) {
    
    .sticky-header h1 {
        font-size: 0.95em;
    }
    .sticky-header p {
        font-size: 0.65em;
    }
    
    .gallery-grid {
        gap: 8px;
    }
    
    .filter-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
    
    /* ★ 초소형에서 이미지 축소 */
    .modal-body {
        grid-template-columns: 110px 1fr;
    }
    
    .img-container {
        width: 95px;
        height: 120px;
        max-width: 95px;
        max-height: 120px;
    }
    
    .modal-right-header {
        padding: 10px 10px 10px 0;
    }
    
    .modal-title {
        font-size: 0.8rem;
    }
    
    .user-text h2 {
        font-size: 0.75rem;
    }
    
    .hash-tag {
        font-size: 0.6rem;
    }
}