* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-bg-solid: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gradient-primary);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 2rem 1rem;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
    position: relative;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

header p {
    font-size: 1.25rem;
    opacity: 0.95;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    font-weight: 300;
}

.card {
    background: var(--card-bg-solid);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s ease;
    position: relative;
    z-index: 1;
}

.card:hover {
    box-shadow: var(--shadow-xl);
}

.card h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 0.75rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    background: var(--bg-color);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f1f5f9;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-area p {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.upload-area .hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.image-preview {
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.image-info {
    display: flex;
    gap: 2rem;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.image-info #fileName {
    max-width: 60vw;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.grid-settings {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 500;
}

.input-group input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
}

.grid-info {
    flex: 1;
    text-align: right;
}

.grid-info p {
    font-size: 1.125rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.result-button-group {
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

.result-button-group .btn-secondary {
    margin-left: auto;
    margin-right: 0;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.canvas-container {
    text-align: center;
    overflow: auto;
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

#canvas {
    border: 1px solid var(--border-color);
    cursor: crosshair;
    max-width: 100%;
}

.instructions {
    background: #fef3c7;
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 4px solid #f59e0b;
}

.instructions p {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.instructions ul {
    list-style: none;
    padding-left: 1.5rem;
}

.instructions li {
    margin-bottom: 0.25rem;
}

.instructions li:before {
    content: "•";
    color: #f59e0b;
    font-weight: bold;
    display: inline-block;
    width: 1rem;
    margin-left: -1rem;
}

.split-options {
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.radio-label:hover {
    background-color: var(--bg-color);
}

.radio-label input[type="radio"] {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

.output-size-settings {
    padding: 1rem;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 0.75rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.output-filename-settings {
    padding: 1rem;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 0.75rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.filename-settings-toggle {
    transition: opacity 0.2s ease;
}

.filename-settings-toggle:hover {
    opacity: 0.8;
}

.filename-settings-content {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hint {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.result-info {
    text-align: center;
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--success-color);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-item {
    background: var(--bg-color);
    border-radius: 0.5rem;
    padding: 0.5rem;
    text-align: center;
    transition: box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
}

.result-item:hover {
    box-shadow: var(--shadow);
}

.result-item img {
    width: 100%;
    height: auto;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.result-item p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.result-item .file-name {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 2rem 3rem;
    border-radius: 1rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s;
    min-width: 300px;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.info {
    border-left: 4px solid var(--primary-color);
}

.toast i {
    font-size: 1.25rem;
}

.toast.success i {
    color: var(--success-color);
}

.toast.error i {
    color: var(--danger-color);
}

.toast.info i {
    color: var(--primary-color);
}

/* 添加滚动条美化 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
    background-clip: padding-box;
}

/* 输入框美化 */
input[type="number"],
input[type="text"],
select {
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

/* 复选框和单选框美化 */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
    transform: scale(1.1);
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    body::before {
        display: none;
    }

    header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 1.5rem;
        border-radius: 1rem;
    }

    .grid-settings {
        flex-direction: column;
        align-items: stretch;
    }

    .grid-info {
        text-align: left;
    }

    .result-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .upload-area {
        padding: 3rem 1.5rem;
    }

    .upload-area i {
        font-size: 3.5rem;
    }
}
.lang-switch {
    margin-top: 0.5rem;
}

.lang-switch select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background: white;
    color: var(--text-primary);
}

/* FAQ Section Styles */
.faq-container {
    margin-top: 1.5rem;
}

.faq-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-item h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.faq-item p {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 1rem;
}

.faq-item h3 i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

/* Show More Button Styles */
.show-more-container {
    width: 100%;
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.show-more-divider {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.show-more-btn {
    padding: 0.75rem 1.5rem;
    white-space: nowrap;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 500;
}

.show-more-btn:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}


/* ===== 去水印页面 ===== */
.wm-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
}

.wm-toolbar .btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.wm-brush-size {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.wm-brush-size input[type="range"] {
    width: 140px;
}

.wm-stage {
    position: relative;
    display: inline-block;
    max-width: 100%;
    line-height: 0;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.wm-stage img {
    display: block;
    max-width: 100%;
    max-height: 75vh;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

.wm-stage canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

/* ===== 图片压缩 / AI 放大页面 ===== */
.cp-controls {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cp-control-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.cp-list {
    display: grid;
    gap: 0.5rem;
}

.cp-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.cp-row .cp-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cp-row .cp-status {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.cp-saved {
    color: #16a34a;
    font-weight: 700;
    margin-left: 0.4rem;
}

.cp-row .cp-download {
    padding: 0.35rem 0.7rem;
}

.up-preview {
    text-align: center;
    margin-bottom: 1rem;
}

.up-preview img {
    max-width: 100%;
    max-height: 60vh;
    border: 2px solid var(--border-color);
    border-radius: 8px;
}
