@media (max-width: 480px) {

    /* 상품 리스트 2열 그리드 강제화 */
    #resultList,
    #randomRegionList {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px 10px !important;
    }

    /* 검색 결과 카드 스타일 최적화 */
    .result-card,
    .product-card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    }

    .result-card:hover,
    .product-card:hover {
        transform: none !important;
    }

    .result-card-image,
    .product-card .image-container {
        height: 140px !important;
    }

    .result-card-image img,
    .product-card .image-container img {
        object-fit: cover !important;
    }

    .result-card-content,
    .product-card .content {
        padding: 10px 8px !important;
    }

    .result-card-title,
    .product-card h6 {
        font-size: 13px !important;
        margin-bottom: 4px !important;
        padding: 0 !important;
        line-height: 1.4 !important;
        height: 36px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        white-space: normal !important;
    }

    .result-card-price,
    .product-card .price {
        font-size: 15px !important;
        margin-bottom: 4px !important;
    }

    .product-card .region-info {
        font-size: 11px !important;
        margin-bottom: 4px !important;
    }

    /* 검색창 및 헤더 UI 최적화 */
    .search-section {
        margin-bottom: 16px !important;
    }

    .search-box {
        flex-wrap: wrap !important;
        gap: 8px !important;
        padding: 12px !important;
    }

    .search-box .form-control {
        height: 44px !important;
        font-size: 16px !important;
        /* iOS 줌인 방지 */
    }

    .search-box .btn-primary {
        width: 100% !important;
        height: 44px !important;
        justify-content: center !important;
    }

    .search-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 16px !important;
        gap: 12px !important;
    }

    .search-header-right {
        width: 100% !important;
    }

    .search-info-badge {
        width: 100% !important;
        justify-content: space-between !important;
        padding: 10px 12px !important;
    }

    /* 필터 패널 최적화 */
    .filter-content {
        padding: 16px 12px !important;
    }

    .filter-row-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }

    .filter-group {
        margin-bottom: 0 !important;
    }

    .filter-group label {
        font-size: 14px !important;
        margin-bottom: 6px !important;
    }

    .form-control {
        height: 44px !important;
        font-size: 16px !important;
    }

    .keyword-input-group {
        display: flex;
        gap: 8px;
    }

    .keyword-input-group .btn-outline {
        padding: 0 16px !important;
        white-space: nowrap;
    }

    /* 가격 정책 섹션 */
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        max-width: 100% !important;
        padding: 0 !important;
    }

    .pricing-card {
        padding: 12px !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .pricing-card .plan-name {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }

    .pricing-card .plan-price {
        font-size: 24px !important;
        margin-bottom: 12px !important;
    }

    .pricing-card .plan-price .period {
        font-size: 11px !important;
    }

    .pricing-card .plan-features {
        margin-bottom: 16px !important;
    }

    .pricing-card .plan-features li {
        padding: 4px 0 !important;
        font-size: 11px !important;
        gap: 4px !important;
    }

    .pricing-card .plan-features li i {
        font-size: 12px !important;
    }

    .pricing-card .btn-plan {
        padding: 8px !important;
        font-size: 12px !important;
    }

    .db-main-hero {
        padding: 24px 16px 20px !important;
        margin-bottom: 20px !important;
    }

    .db-main-title {
        font-size: 22px !important;
        word-break: keep-all;
    }

    /* 결과 섹션 헤더 */
    .result-section .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    .result-section .section-header-right {
        width: 100% !important;
        justify-content: space-between !important;
    }

    /* 여백 조정 */
    .main-content {
        padding-top: 60px !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .content-container {
        padding: 0 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .result-section,
    #randomRegionSection {
        padding: 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    html {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    /* 검색 조건 정보 숨기기 */
    #resultFilterInfo {
        display: none !important;
    }

    /* 상세 필터 패널 압축 */
    .detail-filter-panel {
        margin-bottom: 16px !important;
    }

    .filter-panel-header {
        padding: 12px 16px !important;
    }

    .filter-panel-header h3 {
        font-size: 14px !important;
        margin: 0 !important;
    }

    .filter-header-actions {
        gap: 8px !important;
    }

    .sort-group-inline label {
        font-size: 12px !important;
    }

    .sort-group-inline .form-control-sm {
        padding: 4px 8px !important;
        font-size: 12px !important;
        min-width: 90px !important;
    }

    .filter-panel-content {
        padding: 16px !important;
    }

    .filter-row-keywords {
        gap: 12px !important;
        margin-bottom: 16px !important;
    }

    .filter-group {
        margin-bottom: 16px !important;
    }

    .filter-group label {
        font-size: 12px !important;
        margin-bottom: 8px !important;
    }

    .keyword-input-group {
        gap: 6px !important;
        margin-bottom: 8px !important;
    }

    .keyword-input-group .btn-sm {
        padding: 6px 12px !important;
        font-size: 11px !important;
    }

    .keywords-list {
        gap: 6px !important;
        min-height: 28px !important;
    }

    .keyword-tag {
        padding: 4px 8px !important;
        font-size: 11px !important;
    }

    .price-range-group {
        gap: 8px !important;
    }

    .price-range-group input {
        font-size: 14px !important;
        padding: 8px 12px !important;
    }

    .filter-actions {
        margin-top: 16px !important;
        gap: 8px !important;
    }

    .filter-actions button {
        padding: 8px 16px !important;
        font-size: 12px !important;
    }

    .modal-box {
        width: 95% !important;
        padding: 24px 16px !important;
    }

    .subscription-plans-table {
        margin-top: 10px !important;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .subscription-plans-table th,
    .subscription-plans-table td {
        padding: 10px 8px !important;
        font-size: 13px !important;
    }

    .subscription-plans-table .plan-name {
        font-size: 14px !important;
    }

    .modal-close-btn {
        padding: 8px !important;
    }

    .direct-chat-qr-box {
        padding: 12px !important;
    }

    .direct-chat-qr-actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        margin-top: 12px !important;
    }

    .direct-chat-qr-actions .btn-primary,
    .direct-chat-qr-actions .btn-outline {
        width: 100% !important;
        justify-content: center !important;
        min-height: 44px !important;
        font-size: 14px !important;
    }

    .direct-chat-qr-hint {
        font-size: 13px !important;
        line-height: 1.5 !important;
        text-align: center !important;
    }
}

@media (max-width: 768px) {
    .direct-chat-modal-box {
        width: calc(100% - 20px) !important;
        max-width: 520px !important;
        max-height: calc(100dvh - 20px) !important;
        padding: 18px !important;
        overscroll-behavior: contain;
    }

    .direct-chat-modal-header {
        margin-bottom: 14px !important;
    }

    .direct-chat-modal-header h3 {
        font-size: 19px !important;
    }

    .direct-chat-product-box,
    .direct-chat-login-box,
    .direct-chat-qr-box {
        margin-bottom: 11px !important;
    }

    .direct-chat-quick-template-list {
        width: calc(100% + 18px);
        margin-right: -18px;
        padding-right: 18px;
        scroll-snap-type: x proximity;
    }

    .direct-chat-quick-template {
        min-height: 36px;
        padding: 0 12px;
        font-size: 12px;
        scroll-snap-align: start;
    }

    .direct-chat-template-insert-choice {
        align-items: stretch;
        flex-direction: column;
        gap: 7px;
    }

    .direct-chat-template-insert-choice > div {
        display: grid;
        grid-template-columns: 1fr 1fr 32px;
    }

    .direct-chat-template-insert-choice button {
        min-height: 34px;
    }

    .direct-chat-message-input {
        min-height: 118px !important;
        resize: none !important;
        font-size: 16px !important;
    }

    .direct-chat-modal-actions {
        position: sticky;
        bottom: -18px;
        z-index: 2;
        margin: 14px -18px -18px !important;
        padding: 12px 18px max(12px, env(safe-area-inset-bottom));
        border-top: 1px solid #eceef1;
        background: rgba(255, 255, 255, 0.98);
    }

    .direct-chat-modal-actions .btn-primary,
    .direct-chat-modal-actions .btn-outline {
        flex: 1 1 0;
        min-height: 44px;
    }

    #directChatTemplateManagerModal {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    #directChatTemplateManagerModal .direct-chat-template-manager-box {
        width: 100% !important;
        max-width: none !important;
        max-height: 88dvh !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 16px 16px 0 0 !important;
        transform: translateY(24px) !important;
    }

    #directChatTemplateManagerModal.show .direct-chat-template-manager-box {
        transform: translateY(0) !important;
    }

    .direct-chat-template-manager-header {
        position: sticky;
        top: 0;
        z-index: 3;
        min-height: 62px;
        padding: 13px 16px;
    }

    .direct-chat-template-manager-header h3 {
        font-size: 17px !important;
    }

    .direct-chat-template-manager-body {
        display: block;
        max-height: calc(88dvh - 62px);
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .direct-chat-template-editor,
    .direct-chat-template-custom-section,
    .direct-chat-template-system-section {
        padding: 16px;
        overflow: visible;
    }

    .direct-chat-template-editor {
        border-right: 0;
        border-bottom: 1px solid #e5e7eb;
    }

    .direct-chat-template-custom-section {
        border-bottom: 1px solid #e5e7eb;
    }

    #directChatTemplateTitle,
    #directChatTemplateMessage {
        font-size: 16px;
    }

    .direct-chat-template-form-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .direct-chat-template-form-footer > div {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    #directChatTemplateCancelEdit[hidden] + #directChatTemplateSaveButton {
        grid-column: 1 / -1;
    }

    .direct-chat-template-form-footer .btn-primary,
    .direct-chat-template-form-footer .btn-outline {
        min-height: 42px;
    }

    .direct-chat-template-row {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .direct-chat-template-row-actions {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        width: 100%;
        gap: 5px;
    }

    .direct-chat-template-row-actions .direct-chat-template-icon-btn {
        width: 100%;
        min-height: 36px;
    }

    .direct-chat-system-template-row {
        gap: 10px;
    }

    .direct-chat-system-template-row > .direct-chat-template-icon-btn {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .live-preview-options {
        margin-top: 16px !important;
        padding: 13px !important;
        border-radius: 12px !important;
    }

    .live-preview-options-title {
        margin-bottom: 10px !important;
        font-size: 14px !important;
    }

    .live-preview-options-list {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .live-preview-option {
        gap: 9px !important;
        padding: 11px !important;
    }

    .live-preview-option-copy strong {
        font-size: 13px !important;
    }

    .live-preview-option-copy small {
        font-size: 11px !important;
    }

    .progress-title {
        margin-bottom: 16px !important;
        font-size: 18px !important;
    }

    .live-preview-panel {
        margin-top: 14px !important;
        padding: 14px !important;
        border-radius: 13px !important;
    }

    .live-preview-header {
        align-items: stretch !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .live-preview-title-row {
        align-items: flex-start !important;
        flex-direction: column !important;
        gap: 4px !important;
    }

    .live-preview-title-row h3 {
        font-size: 16px !important;
    }

    .live-preview-heading p {
        margin-top: 4px !important;
        font-size: 11px !important;
    }

    #livePreviewUpdatedAt {
        font-size: 11px !important;
    }

    .live-preview-toggle-btn {
        width: 100% !important;
        min-height: 38px !important;
    }

    .live-preview-new-badge {
        width: 100% !important;
        margin-top: 13px !important;
        min-height: 40px !important;
    }

    .live-preview-status {
        margin: 11px 0 !important;
        font-size: 11px !important;
    }

    #livePreviewList {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .live-preview-card {
        border-radius: 10px !important;
    }

    .live-preview-card:hover {
        transform: none !important;
    }

    .live-preview-card-image {
        height: 112px !important;
    }

    .live-preview-card-content {
        min-height: 115px !important;
        padding: 9px !important;
    }

    .live-preview-card-content h4 {
        min-height: 35px !important;
        margin-bottom: 6px !important;
        font-size: 12px !important;
    }

    .live-preview-card-content > strong {
        font-size: 14px !important;
    }

    .live-preview-card-meta {
        align-items: flex-start !important;
        flex-direction: column !important;
        gap: 3px !important;
        margin: 7px 0 9px !important;
        font-size: 10px !important;
    }

    .live-preview-card-meta span:last-child {
        white-space: normal !important;
    }

    .live-preview-open-button {
        min-height: 32px !important;
        padding: 6px 4px !important;
        font-size: 10px !important;
    }

    .live-preview-card-actions {
        gap: 5px !important;
        padding: 0 9px 9px !important;
    }

    .live-preview-card-actions > .direct-chat-btn {
        min-height: 32px !important;
        padding: 6px 4px !important;
        font-size: 10px !important;
    }
}
