* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    transition: background-color 2s ease;
    position: relative;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 30s ease infinite;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 1rem 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.container.image-uploaded {
    justify-content: flex-start;
    padding-top: 6rem;
    min-height: calc(100vh + 5rem);
}

h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-family: 'Montserrat', sans-serif;
    height: 72px;
    background: url('https://maxpcimg.cc/i/2024/11/30/674a9d58f13f5.png') no-repeat center;
    background-size: contain;
    font-size: 0;
    position: relative;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    animation: shine 3s ease infinite;
}

.image-uploaded h1 {
    height: 48px;
    background: url('https://maxpcimg.cc/i/2024/11/30/674a9d58f13f5.png') no-repeat center;
    background-size: contain;
}

.subtitle {
    text-align: center;
    color: #ffffff;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-family: 'Long Cang', cursive;
    position: relative;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 2px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 2rem auto;
    max-width: 600px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-area:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateX(-50%) scale(1.02);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.upload-area input {
    display: none;
}

.upload-area p {
    color: #2c3e50;
    font-size: 1.1rem;
    margin: 0;
    white-space: nowrap;
}

.image-info {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    color: #666;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.image-info.visible {
    opacity: 1;
}

.preview-container {
    margin: 1rem auto;
    text-align: center;
    width: 100%;
    opacity: 0;
    transform: scale(1.1);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
    position: relative;
    z-index: 1;
}

.preview-container.visible {
    opacity: 1;
    transform: scale(1);
    display: block;
}

#imagePreview {
    width: 100%;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    object-fit: contain;
    cursor: pointer;
}

#imagePreview:hover {
    filter: brightness(0.9);
}

@media (min-width: 768px) {
    .preview-container {
        width: 80%;
    }
}

.colors-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    opacity: 0;
    transition: opacity 0.8s ease;
    margin: 1rem auto;
    padding-bottom: 3rem;
    min-height: 120px;
    max-width: 600px;
}

.color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.color-item:hover {
    transform: scale(1.1);
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.color-info {
    text-align: center;
}

.color-code {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #ffffff;
    font-size: 0.8rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.color-percentage {
    color: #ffffff;
    font-size: 0.8rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.color-percentage span,
.color-code span {
    font-family: 'Montserrat', sans-serif;
}

.image-details {
    display: none;
}

.image-details-modal .modal-title {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 1.5rem;
}

.modal-list {
    list-style: none;
    padding: 0;
}

.modal-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
    margin-bottom: 0.5rem;
}

.detail-label {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
}

.detail-value {
    color: #2c3e50;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.9rem;
}

.detail-value .number {
    font-family: 'Montserrat', sans-serif;
}

.color-code-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 背景动画 */
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 移除加载动画相关样式 */
.loading-screen,
.loading-animation,
.loading-animation:after {
    display: none;
}

/* 添加新的背景样式 */
.background-overlay {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    transition: background-color 2s ease-in-out;
}

.upload-area.expanding {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.2);
    padding: 0;
    margin: 0 auto;
}

.upload-area .content {
    position: absolute;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.upload-area.expanding .content {
    opacity: 0;
    visibility: hidden;
}

.upload-area.expanding::before {
    display: none;
}

/* 添加颜色详情弹窗样式 */
.color-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    min-width: 300px;
    max-width: 90vw;
}

.color-modal.visible {
    opacity: 1;
    visibility: visible;
}

.modal-color-preview {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    margin: 0 auto 1.5rem auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.color-values-list {
    list-style: none;
    padding: 0;
}

.color-value-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.color-value-item:hover {
    background: rgba(0, 0, 0, 0.1);
}

.color-value-item span.value {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #2c3e50;
}

.color-value-item span.value .number {
    font-family: 'Montserrat', sans-serif;
}

.color-value-label {
    font-size: 0.9rem;
    color: #666;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* 复制提示样式 */
.copy-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* 修改英文和数字的字体置 */
.color-code span,
.color-percentage span,
.detail-value .number,
.color-value-item span.value,
.color-value-item span.value .number,
.color-value-label,
.image-info span,
.detail-value {
    font-family: 'Montserrat', sans-serif;
}

/* 添加一个包装容器来管理上传区域和预览容器 */
.content-wrapper {
    position: relative;
    min-height: 200px;
    margin: 1rem 0;
}

/* 添加按钮样式 */
.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.action-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.2rem;
    border: none;
    border-radius: 8px;
    background: #3498db;
    color: white;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-button:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.action-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-button svg {
    width: 16px;
    height: 16px;
}

/* 调整弹窗内容的间距 */
.image-details-modal .modal-list {
    margin-bottom: 0;
}

/* 修改裁切弹窗样式 */
.cropper-modal {
    max-width: 90vw;
    max-height: 90vh;
    width: 90vw;  /* 设置固定宽度 */
    height: 80vh; /* 设置固定高度 */
    display: flex;
    flex-direction: column;
}

.cropper-container {
    flex: 1;        /* 让容器占据剩余空间 */
    margin: 1rem 0;
    width: 100%;    /* 确保宽度填满 */
    position: relative;
    overflow: hidden;
}

#cropperImage {
    max-width: 100%;
    max-height: calc(80vh - 150px); /* 减去标题和按钮的高度 */
}

/* 调整按钮容器在裁切弹窗中的位置 */
.cropper-modal .modal-actions {
    margin-top: auto;  /* 将按钮推到底部 */
    padding-top: 1rem;
}

/* 调整标题在裁切弹窗中的位置 */
.cropper-modal .modal-title {
    margin-bottom: 1rem;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* 调整 Cropper.js 的样式 */
.cropper-view-box,
.cropper-face {
    border-radius: 0;
}

.cropper-line,
.cropper-point {
    background-color: #3498db;
}

.cropper-view-box {
    outline: 2px solid #3498db;
    outline-color: rgba(52, 152, 219, 0.75);
}

/* 添加移动端触摸的样式 */
@media (max-width: 768px) {
    .cropper-modal {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
        padding: 1rem;
    }

    .cropper-container {
        touch-action: none; /* 防止默认的触摸行为 */
    }

    /* 增大触摸点的大小 */
    .cropper-point {
        width: 20px;
        height: 20px;
    }

    .cropper-line {
        width: 3px;
        height: 3px;
    }

    /* 调整钮大小和间距 */
    .modal-actions {
        gap: 0.5rem;
    }

    .action-button {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
}

/* 添加触摸反馈效果 */
.cropper-face,
.cropper-line,
.cropper-point {
    -webkit-tap-highlight-color: transparent; /* 移除触摸高亮 */
}

/* 优化移动端的拖动手柄 */
.cropper-point {
    opacity: 0.75;
    background-color: #3498db;
}

.cropper-point:active {
    opacity: 1;
    background-color: #2980b9;
}

.upload-icon {
    color: #2c3e50;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.upload-area:hover .upload-icon {
    transform: translateY(-2px);
    opacity: 1;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .upload-area {
        width: 90vw;
        max-width: none;
        padding: 2rem 1rem;
    }

    .upload-area p {
        font-size: 1rem;
    }

    .upload-icon {
        width: 28px;
        height: 28px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 360px) {
    .upload-area p {
        font-size: 0.9rem;
    }
}

/* 修改颜色提示器样式 */
.color-tip {
    position: fixed;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    pointer-events: none;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.color-tip.visible {
    opacity: 1;
    display: flex;
}

.tip-color {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.tip-values {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tip-values span {
    font-family: 'Montserrat', sans-serif;
    color: #2c3e50;
    font-size: 0.95rem;
}

/* 添加渐变动画 */
@keyframes shine {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

/* 在移动端适当减小留白 */
@media (max-width: 768px) {
    .container {
        padding-top: 2rem;
    }

    .container.image-uploaded {
        padding-top: 4rem;
    }
}

/* 添加底部浮动按钮样式 */
.floating-buttons {
    position: static;
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem auto;
    padding: 0.8rem;
}

.floating-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2c3e50;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    text-decoration: none;
}

.floating-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.95);
}

.floating-button svg {
    width: 18px;
    height: 18px;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

/* 修改隐藏颜色按钮样式 */
.hide-color {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.2rem;
    border: none;
    border-radius: 8px;
    background: #e74c3c;
    color: white;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin-top: 1rem;
}

.hide-color:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.hide-color:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hide-color svg {
    width: 16px;
    height: 16px;
}

/* 优化弹窗布局 */
.color-modal {
    display: flex;
    flex-direction: column;
}

.modal-actions {
    margin-top: auto;
    padding-top: 1rem;
}

/* 分享按钮样式 */
.share-button {
    background: rgba(255, 255, 255, 0.6);
}

/* 分享预览样式 */
.share-preview {
    margin: 1rem 0;
    text-align: center;
}

.share-preview img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Toast 提示样式 */
.toast {
    position: fixed;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 分享弹窗样式 */
.share-modal {
    max-width: 90vw;
    width: 90vw;
    max-height: 90vh;
    height: auto;
    overflow: hidden;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    margin: 2rem;
}

.share-preview {
    margin: 1rem 0;
    text-align: center;
    background: rgba(0, 0, 0, 0.05);
    padding: 1rem;
    border-radius: 8px;
    flex: 1;
    overflow-y: auto;
    max-height: calc(90vh - 180px); /* 减去标题和按钮的高度 */
    -webkit-overflow-scrolling: touch; /* 提升移动端滚动体验 */
}

.share-preview::-webkit-scrollbar {
    width: 8px;
}

.share-preview::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.share-preview::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.share-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: block;
    margin: 0 auto;
}

.share-modal .modal-title {
    margin-bottom: 1rem;
    padding-right: 40px; /* 为关闭按钮留出空间 */
}

.share-modal .modal-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
    position: sticky;
    bottom: 0;
    background: #fff;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.share-modal .action-button {
    width: 100%;
    justify-content: center;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .share-modal {
        width: 100vw;
        max-width: 100vw;
        height: auto;
        max-height: 85vh; /* 稍微降低高度，避免在某些机型上出现问题 */
        margin: 0;
        border-radius: 16px 16px 0 0;
        padding: 1.5rem 1rem 1rem;
        position: fixed;
        bottom: 0;
        left: 0;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .share-modal.visible {
        transform: translateY(0);
    }
    
    .share-preview {
        max-height: calc(85vh - 160px);
        margin: 0.5rem 0;
    }
    
    .share-modal .modal-actions {
        padding: 1rem 0 env(safe-area-inset-bottom, 0); /* 适配全面屏 */
        margin: 1rem 0 0 0;
    }
    
    /* 优化移动端滚动体验 */
    .share-preview {
        scrollbar-width: none; /* Firefox */
    }
    
    .share-preview::-webkit-scrollbar {
        display: none; /* Chrome, Safari */
    }
}

/* 修改遮罩层样式 */
.modal-overlay {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* 添加动画效果 */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes modalSlideInMobile {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* 应用动画 */
.share-modal {
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
    .share-modal {
        animation: modalSlideInMobile 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* 确认对话框样式 */
.confirm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 90vw;
    width: 400px;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
}

.confirm-dialog.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.confirm-dialog-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.confirm-dialog-message {
    color: #666;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.confirm-dialog-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.confirm-dialog .action-button {
    min-width: 100px;
}

.confirm-dialog .cancel-button {
    background: #e0e0e0;
    color: #666;
}

.confirm-dialog .cancel-button:hover {
    background: #d0d0d0;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .confirm-dialog {
        width: 85vw;
    }
    
    .confirm-dialog-actions {
        flex-direction: column-reverse;
    }
    
    .confirm-dialog .action-button {
        width: 100%;
    }
}
