* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo-container svg {
    transition: transform 0.3s ease;
}

.logo-container:hover svg {
    transform: scale(1.05);
}

header h1 {
    font-size: 2.5rem;
    margin: 0;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2px;
}

.char-animate {
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
    transform-origin: center bottom;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) scale(1);
    }
    10% {
        transform: translateY(-8px) scale(1.05);
    }
    40% {
        transform: translateY(-4px) scale(1.02);
    }
    60% {
        transform: translateY(-2px) scale(1.01);
    }
}

.char-animate:hover {
    animation-play-state: paused;
    transform: translateY(-6px) scale(1.1);
    color: #667eea;
    transition: all 0.3s ease;
}

header p {
    font-size: 1.1rem;
    opacity: 0.7;
    color: #666;
}

.important-notice {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 12px 20px;
    margin-top: 15px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.15);
}

.important-notice p {
    margin: 0;
    color: #856404;
    font-size: 0.95rem;
    opacity: 1;
    line-height: 1.4;
}

.important-notice strong {
    color: #664d03;
}

/* 算法机制详解区域 */
.algorithm-mechanism {
    background: #ffffff;
    border-radius: 16px;
    padding: 25px;
    margin: 20px 0 30px 0;
    border: 1px solid #e1e5e9;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.algorithm-mechanism h3 {
    color: #333;
    font-size: 1.4rem;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}

.mechanism-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.mechanism-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.mechanism-header h4 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.mechanism-content p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 12px;
}

.mechanism-content ul {
    color: #666;
    line-height: 1.6;
    margin: 10px 0;
    padding-left: 20px;
}

.mechanism-content li {
    margin-bottom: 6px;
}

.mechanism-features {
    margin-bottom: 25px;
}

.mechanism-features h4 {
    color: #333;
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.feature-item {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: #667eea;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.feature-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

.feature-text strong {
    color: #333;
    font-weight: 600;
}

.use-cases h4 {
    color: #333;
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
}

.use-cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.use-case {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.use-case:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: #28a745;
}

.use-case strong {
    color: #333;
    font-size: 1rem;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

.use-case p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
}

.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 25px;
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08), 0 2px 10px rgba(0,0,0,0.04);
    border: 1px solid #e5e7eb;
}

.input-section, .output-section {
    display: flex;
    flex-direction: column;
    background: #fcfcfd;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #f1f3f4;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h2 {
    color: #333;
    font-size: 1.4rem;
    font-weight: 600;
}

textarea {
    flex: 1;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    padding: 15px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    resize: none;
    transition: all 0.3s ease;
    line-height: 1.5;
    background: #fafbfc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), inset 0 1px 3px rgba(0,0,0,0.04);
    min-height: 280px;
    max-height: 400px;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 0 0 3px rgba(102, 126, 234, 0.1), inset 0 1px 3px rgba(0,0,0,0.02);
}

textarea::placeholder {
    color: #999;
}

textarea.drag-over {
    border-color: #667eea !important;
    background: #f0f2ff !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15) !important;
}

#outputText {
    background-color: #f1f3f4;
    color: #333;
    border-color: #c1c7cd;
}

.input-info, .output-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}

.drag-hint {
    font-style: italic;
    color: #999;
    font-size: 11px;
}

/* 中间区域的紧凑算法信息 */
.algorithm-info-compact {
    margin-top: 20px;
    width: 100%;
}

.current-algorithm-info h4 {
    color: #333;
    font-size: 1rem;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
}

.current-card {
    background: #ffffff;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.current-card.active {
    background: linear-gradient(135deg, #667eea10, #764ba210);
    border-color: #667eea;
}

/* 底部完整算法简介区域 */
.algorithm-details {
    max-width: 1400px;
    margin: 30px auto 0;
    padding: 30px 20px;
    background: #f8f9fa;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}

.algorithm-details h2 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 600;
}

.algorithm-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.info-card {
    background: #ffffff;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12), 0 4px 10px rgba(0,0,0,0.08);
    border-color: #667eea;
}

.info-card.active {
    background: linear-gradient(135deg, #667eea10, #764ba210);
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.algorithm-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.algorithm-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.algorithm-badge.legacy {
    background: #dc354520;
    color: #dc3545;
}

.algorithm-badge.popular {
    background: #fd7e1420;
    color: #fd7e14;
}

.algorithm-badge.deprecated {
    background: #ffc10720;
    color: #ffc107;
}

.algorithm-badge.recommended {
    background: #28a74520;
    color: #28a745;
}

.algorithm-badge.secure {
    background: #667eea20;
    color: #667eea;
}

.info-card p {
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
    font-size: 14px;
}

.card-specs {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #888;
}

.card-specs span {
    background: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.control-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 250px;
    gap: 25px;
    background: #f8f9fa;
    border-radius: 16px;
    padding: 25px 20px;
    border: 1px solid #e9ecef;
}

.algorithm-selector h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2rem;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    user-select: none;
}

.radio-item:hover {
    background-color: #f0f2ff;
}

.radio-item input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.radio-item input[type="radio"]:checked + .radio-custom {
    border-color: #667eea;
    background-color: #667eea;
}

.radio-item input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: white;
}

.encrypt-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 140px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.encrypt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.4);
}

.encrypt-btn:active {
    transform: translateY(0);
}

.encrypt-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.clear-btn {
    background: transparent;
    color: #666;
    border: 2px solid #ddd;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.copy-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: #218838;
}

.file-upload-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-btn {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.upload-btn:hover {
    background: #138496;
    transform: translateY(-1px);
}

.upload-btn:active {
    transform: translateY(0);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    transform: translateX(400px);
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 300px;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.info {
    background: #17a2b8;
}

footer {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 14px;
}

/* 减少动画偏好设置 */
@media (prefers-reduced-motion: reduce) {
    .char-animate {
        animation: none;
    }
    
    .char-animate:hover {
        transform: none;
        color: #667eea;
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .control-section {
        order: -1;
        min-width: auto;
    }
    
    .algorithm-selector {
        width: 100%;
    }
    
    .radio-group {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .radio-item {
        flex: 0 0 auto;
    }
    
    .algorithm-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
        gap: 1px;
    }
    
    .char-animate {
        animation-duration: 2.5s;
    }
    
    @keyframes bounce {
        0%, 20%, 50%, 80%, 100% {
            transform: translateY(0) scale(1);
        }
        10% {
            transform: translateY(-6px) scale(1.03);
        }
        40% {
            transform: translateY(-3px) scale(1.01);
        }
        60% {
            transform: translateY(-1px) scale(1.005);
        }
    }
    
    .header-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo-container svg {
        width: 50px;
        height: 50px;
    }
    
    .important-notice {
        padding: 10px 15px;
        margin-top: 10px;
    }
    
    .important-notice p {
        font-size: 0.9rem;
    }
    
    .algorithm-mechanism {
        padding: 15px;
        margin: 15px 0 20px 0;
    }
    
    .algorithm-mechanism h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .mechanism-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .mechanism-card {
        padding: 15px;
    }
    
    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .feature-item {
        padding: 12px;
    }
    
    .feature-icon {
        font-size: 1.5rem;
        margin-bottom: 6px;
    }
    
    .use-cases-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .use-case {
        padding: 12px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    textarea {
        min-height: 120px;
    }
    
    .radio-group {
        flex-direction: column;
    }
    
    .algorithm-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .info-card {
        padding: 15px;
    }
    
    .card-specs {
        flex-direction: column;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .algorithm-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .algorithm-details {
        padding: 20px 15px;
    }
    
    .algorithm-details h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
}

/* 滚动条样式 */
textarea::-webkit-scrollbar {
    width: 8px;
}

textarea::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

textarea::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

textarea::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
