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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.header h1 {
    color: #333;
    font-size: 28px;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 14px;
}

.credits-display {
    margin-top: 15px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    display: inline-block;
}

.credits-label {
    color: white;
    font-size: 14px;
    margin-right: 8px;
}

.credits-count {
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    margin-right: 8px;
}

.credits-count.trial {
    color: #ffd700;
}

.trial-badge {
    background: #ffd700;
    color: #333;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
}

/* 步骤指示器 */
.steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
}

.step {
    flex: 1;
    text-align: center;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-weight: bold;
    transition: all 0.3s;
}

.step.active .step-number {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.step.completed .step-number {
    background: #4caf50;
    color: white;
}

.step-title {
    font-size: 14px;
    color: #666;
}

.step.active .step-title {
    color: #667eea;
    font-weight: bold;
}

/* 表单样式 */
.step-content {
    animation: fadeIn 0.3s;
}

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

.step-content h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 24px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

textarea.form-control {
    resize: vertical;
    font-family: inherit;
}

.hint {
    margin-top: 8px;
    font-size: 13px;
    color: #667eea;
}

.auto-style-hint {
    background: #f0f7ff;
    border-left: 4px solid #667eea;
    padding: 16px 20px;
    border-radius: 4px;
    margin-top: 20px;
}

.auto-style-hint .hint {
    margin: 0;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}

/* 风格方式选择 - 表格布局 */
.style-mode-table {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
}

.style-mode-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.style-mode-cell:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.style-mode-cell input[type="radio"] {
    margin-bottom: 12px;
    cursor: pointer;
}

.style-mode-content {
    width: 100%;
}

.style-mode-title {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.style-mode-cell input[type="radio"]:checked ~ .style-mode-content .style-mode-title {
    color: #667eea;
}

.style-mode-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .style-mode-table {
        grid-template-columns: 1fr;
    }
}

/* 生成进度动画 */
.generating-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.generating-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.generating-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
}

.generating-hint {
    font-size: 13px;
    color: #999;
}

.char-count {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.char-count.error {
    color: #f44336;
}

/* 学科卡片容器 */
.subjects-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.subject-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    background: white;
    transition: all 0.3s;
}

.subject-card.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.subject-header {
    margin-bottom: 10px;
}

.subject-name {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.progress-options {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.progress-label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.radio-group-inline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-label-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
}

.radio-label-inline:hover {
    background: rgba(102, 126, 234, 0.08);
}

.radio-label-inline input[type="radio"] {
    cursor: pointer;
}

/* 复选框和单选框 */
.checkbox-group, .radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.checkbox-label:hover, .radio-label:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.checkbox-label input, .radio-label input {
    margin-right: 8px;
}

/* 按钮 */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: flex-end;
}

/* 导航按钮组 - 固定在底部 */
.button-group.navigation-buttons {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    justify-content: space-between;
}

.button-group.navigation-buttons button:only-child {
    margin-left: auto;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #e0e0e0;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #45a049;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-large {
    padding: 16px 48px;
    font-size: 16px;
}

/* 素材列表 */
.material-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.material-item {
    padding: 20px;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
    background: #fafafa;
}

.material-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.material-header h3 {
    color: #667eea;
    font-size: 18px;
}

/* 写作样本 */
.writing-samples {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.sample-item {
    padding: 20px;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
}

.sample-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.sample-header h3 {
    color: #667eea;
    font-size: 16px;
}

/* 生成结果 */
.generate-section {
    text-align: center;
    padding: 60px 0;
}

.version-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.version-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.version-tab:hover {
    color: #667eea;
}

.version-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: bold;
}

.version-content {
    animation: fadeIn 0.3s;
}

.editor-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.editor {
    font-size: 15px;
    line-height: 1.8;
    min-height: 400px;
}

.word-count-display {
    text-align: right;
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

.word-count-display .error {
    color: #f44336;
    font-weight: bold;
}

/* 消息提示 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s;
    z-index: 1000;
}

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

.message.success {
    background: #4caf50;
    color: white;
}

.message.error {
    background: #f44336;
    color: white;
}

.message.warning {
    background: #ff9800;
    color: white;
}

.message.info {
    background: #2196f3;
    color: white;
}

/* 响应式 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .steps {
        flex-wrap: wrap;
    }
    
    .step {
        flex-basis: 50%;
        margin-bottom: 20px;
    }
    
    .checkbox-group, .radio-group {
        grid-template-columns: 1fr;
    }
}

/* 版本标签优化 */
.version-tabs {
    display: flex;
    gap: 16px;
    margin-bottom: 30px;
}

.version-tab {
    flex: 1;
    padding: 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.version-tab:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.version-tab.active {
    border-color: #667eea;
    background: #f8f9ff;
}

.version-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.version-tab.active .version-title {
    color: #667eea;
}

.version-desc {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    line-height: 1.4;
}

.version-count {
    font-size: 12px;
    color: #999;
}

/* 编辑操作区域 */
.edit-actions {
    margin-top: 30px;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 8px;
}

.edit-actions h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: #333;
}

.edit-actions .hint {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.edit-input-group {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.edit-input-group textarea {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.3s;
}

.edit-input-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.edit-input-group button {
    padding: 12px 24px;
    min-width: 100px;
    height: fit-content;
    white-space: nowrap;
}

/* ==================== 购买弹窗样式 ==================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    color: #333;
}

.purchase-modal h2 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
}

.remaining-info {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.remaining-info strong {
    color: #667eea;
    font-size: 20px;
}

.packages {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.package-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.package-card:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.2);
}

.package-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.package-card.recommended {
    border-color: #ffd700;
}

.package-card .badge {
    position: absolute;
    top: -10px;
    right: 20px;
    background: #ffd700;
    color: #333;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.package-header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.package-header h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 10px;
}

.price {
    color: #667eea;
    font-size: 32px;
    font-weight: bold;
}

.original-price {
    color: #999;
    font-size: 16px;
    text-decoration: line-through;
    margin-left: 8px;
}

.package-details {
    color: #666;
    font-size: 14px;
}

.package-details p {
    margin: 8px 0;
}

.package-details .highlight {
    color: #667eea;
    font-weight: bold;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-purchase {
    flex: 1;
    max-width: 200px;
}

.purchase-note {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .action-buttons {
        grid-template-columns: 1fr;
    }

    .version-tabs {
        flex-direction: column;
    }

    .packages {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 30px 20px;
    }
}
