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

:root {
    --primary-color: #007AFF;
    --primary-dark: #0051D5;
    --primary-light: #5AC8FA;
    --secondary-color: #FF3B30;
    --success-color: #34C759;
    --error-color: #FF3B30;
    --text-dark: #1d1d1f;
    --text-gray: #6e6e73;
    --border-color: #e5e5ea;
    --bg-light: #f5f5f7;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #f5f5f7;
    min-height: 100vh;
    padding: 40px 20px;
    color: var(--text-dark);
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 48px;
    animation: fadeInDown 0.6s ease;
}

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

header h1 {
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-gray);
    font-weight: 400;
}

.form-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    animation: fadeInUp 0.6s ease;
}

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

.form-section {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section h3 {
    color: var(--text-dark);
    margin-bottom: 24px;
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.form-section h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 24px;
    background: var(--primary-color);
    margin-right: 12px;
    border-radius: 2px;
}

.type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.type-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
}

.type-option:hover {
    border-color: var(--primary-color);
    background: #f0f8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
}

.type-option input[type=radio] {
    position: absolute;
    opacity: 0;
}

.type-option input[type=radio]:checked ~ span {
    color: white;
}

.type-option input[type=radio]:checked + span::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--primary-color);
    border-radius: 12px;
    z-index: -1;
}

.type-option span {
    position: relative;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-dark);
    transition: all 0.3s;
    z-index: 1;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.setting-item {
    display: flex;
    flex-direction: column;
}

.setting-item label {
    margin-bottom: 8px;
    color: var(--text-gray);
    font-size: 0.95rem;
    font-weight: 500;
}

.setting-item select,
.setting-item input[type=number] {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
    background: white;
}

.setting-item select:focus,
.setting-item input[type=number]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.content-panel {
    animation: fadeIn 0.4s ease;
}

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

.content-panel label {
    display: block;
    margin-bottom: 12px;
    color: var(--text-gray);
    font-weight: 500;
}

.content-panel textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s;
    line-height: 1.6;
}

.content-panel textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.math-config {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.info-text {
    color: var(--text-gray);
    padding: 24px;
    background: #f0f8ff;
    border-radius: 12px;
    text-align: center;
    border: 2px dashed var(--primary-color);
}

.action-buttons {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    margin-top: 32px;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.3);
}

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

.btn-secondary {
    background: #f5f5f7;
    color: var(--primary-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: #e5e5ea;
    border-color: var(--primary-color);
}

.result-box {
    margin-top: 32px;
    padding: 24px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    animation: slideInUp 0.4s ease;
}

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

.result-box.success {
    border-left: 5px solid var(--success-color);
    background: linear-gradient(to right, #f0fdf4 0%, white 10%);
}

.result-box.error {
    border-left: 5px solid var(--error-color);
    background: linear-gradient(to right, #fff5f5 0%, white 10%);
}

.result-box p {
    font-size: 1.05rem;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.download-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 14px 28px;
    background: var(--success-color);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.25);
}

.download-link:hover {
    background: #2FB350;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(52, 199, 89, 0.3);
}

@media (max-width: 768px) {
    body {
        padding: 20px 16px;
    }
    
    header h1 {
        font-size: 2.2rem;
    }
    
    .form-container {
        padding: 28px;
        border-radius: 20px;
    }
    
    .type-selector {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}
