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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 40px 60px 40px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
}

.logo {
    font-size: clamp(20px, 3vw, 24px);
    font-weight: 700;
    color: #667eea;
    cursor: pointer;
    transition: transform 0.3s;
    user-select: none;
}

.logo:hover {
    transform: scale(1.05);
}

.nav {
    display: flex;
    gap: 20px;
}

.nav a {
    color: #555;
    text-decoration: none;
    font-weight: 500;
    font-size: clamp(14px, 2vw, 16px);
    transition: color 0.3s;
    padding: 8px 12px;
}

.nav a:hover {
    color: #667eea;
}

/* Generate Container */
.generate-container {
    background: white;
    border-radius: 16px;
    padding: clamp(25px, 5vw, 40px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.form-header {
    text-align: center;
    margin-bottom: 40px;
}

.form-header h1 {
    font-size: clamp(24px, 4vw, 32px);
    color: #333;
    margin-bottom: 12px;
}

.form-header p {
    color: #666;
    font-size: clamp(14px, 2vw, 16px);
}

/* Form Groups */
.form-group {
    margin-bottom: 30px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    font-size: clamp(14px, 2vw, 15px);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e1e4e8;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.help-text {
    display: block;
    margin-top: 8px;
    font-size: clamp(12px, 1.5vw, 13px);
    color: #888;
}

/* Title Input Group */
.title-input-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.title-input-group input {
    flex: 1;
    min-width: 200px;
}

.btn-polish {
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    transition: all 0.3s;
}

.btn-polish:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-polish:active {
    transform: translateY(0);
}

/* Upload Area */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafbfc;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #e8edff;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.upload-area p {
    color: #555;
    margin: 5px 0;
    font-size: clamp(14px, 2vw, 16px);
}

.upload-hint {
    font-size: clamp(12px, 1.5vw, 13px);
    color: #888;
}

.file-list {
    margin-top: 15px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    color: #333;
    font-size: clamp(13px, 2vw, 14px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-size: clamp(12px, 1.5vw, 13px);
    color: #888;
    white-space: nowrap;
}

.file-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    min-width: 30px;
}

/* Word Count */
.word-count-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.word-count-group input {
    width: 200px;
    flex-shrink: 0;
}

.unit {
    color: #666;
    font-weight: 500;
}

.word-count-presets {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.word-count-presets button {
    padding: 8px 16px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: clamp(13px, 1.5vw, 14px);
    transition: all 0.3s;
}

.word-count-presets button:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 16px 32px;
    border: none;
    border-radius: 10px;
    font-size: clamp(15px, 2vw, 16px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    flex: 1;
    min-width: 200px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
}

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

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Tips */
.tips {
    margin-top: 40px;
    padding: 25px;
    background: linear-gradient(135deg, #f0f4ff, #e8edff);
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.tips h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: clamp(16px, 2.5vw, 18px);
}

.tips ul {
    list-style: none;
    padding: 0;
}

.tips-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 16px;
    align-items: start;
}

.tips-left,
.tips-right {
    min-width: 0;
}

.tips-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    padding: 10px 10px 12px;
    margin-top: 0;
}

.tips-qr-image {
    width: auto;
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 8px;
}

.tips-qr-text {
    margin-top: 8px;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    line-height: 1.5;
}

.tips li {
    padding: 8px 0;
    color: #555;
    line-height: 1.6;
    position: relative;
    padding-left: 20px;
    font-size: clamp(13px, 1.5vw, 14px);
}

.tips li:before {
    content: "•";
    color: #667eea;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Polish Inline Suggestions */
.polish-inline {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px dashed #e3e5e8;
    background: #f9fafb;
}

.polish-inline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.polish-inline-title {
    font-weight: 600;
    color: #333;
    font-size: clamp(13px, 1.6vw, 14px);
}

.polish-status {
    color: #7a7f87;
    font-size: clamp(11px, 1.4vw, 12px);
}

.polish-options {
    display: grid;
    gap: 8px;
}

.polish-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
}

.polish-option:hover {
    border-color: #1f7a6b;
    background: #f0f7f6;
}

.polish-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #1f7a6b;
    flex-shrink: 0;
}

.polish-option-text {
    font-size: clamp(13px, 1.6vw, 14px);
    color: #333;
    line-height: 1.5;
}

.polish-option input[type="checkbox"]:checked + .polish-option-text {
    color: #0f766e;
    font-weight: 600;
}

.polish-loading-row {
    padding: 10px 12px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #f0f0f0;
}

.polish-loading-row .skeleton-line {
    margin-bottom: 0;
    height: 12px;
    border-radius: 6px;
}

/* 平板设备 (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }

    .generate-container {
        padding: 30px 25px;
    }
}

/* 移动端 (最大768px) */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        flex-wrap: wrap;
        gap: 15px;
    }

    .nav {
        gap: 15px;
    }

    .generate-container {
        padding: 25px 20px;
    }

    .form-header h1 {
        font-size: 24px;
    }

    .title-input-group {
        flex-direction: column;
    }

    .title-input-group input {
        min-width: 100%;
    }

    .btn-polish {
        width: 100%;
    }

    .word-count-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .word-count-group input {
        width: 100%;
    }

    .word-count-presets {
        width: 100%;
    }

    .word-count-presets button {
        flex: 1;
        min-width: calc(50% - 5px);
    }

    .form-actions {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
        min-width: 100%;
    }

    .tips-content {
        grid-template-columns: 1fr;
    }

}

/* 小屏幕手机 (最大480px) */
@media (max-width: 480px) {
    .form-group {
        margin-bottom: 25px;
    }

    .upload-area {
        padding: 30px 15px;
    }

    .upload-icon {
        font-size: 36px;
    }

    .file-item {
        padding: 10px 12px;
    }

    .tips {
        padding: 20px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn-polish:hover,
    .btn-primary:hover,
    .btn-secondary:hover,
    .polish-option:hover,
    .word-count-presets button:hover {
        transform: none;
    }

    .btn-polish:active,
    .btn-primary:active,
    .btn-secondary:active {
        transform: scale(0.98);
    }

    /* 增大触摸目标 */
    .file-remove {
        min-width: 44px;
        min-height: 44px;
    }
}

/* 横屏模式优化 */
@media (max-width: 896px) and (orientation: landscape) {
    .generate-container {
        margin: 20px 0;
    }

}
