* {
    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;
    line-height: 1.5;
    background: linear-gradient(135deg, #edeffe 0%, #eaedff 100%);
    min-height: 100vh;
    padding: 8px;
    margin: 0;
}

.container {
    width: 100%;
    margin: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    text-align: center;
    padding: 15px 20px;
}

header h1 {
    font-size: 1.8rem;
    margin: 0;
    font-weight: 600;
}

.controls {
    background: #f8f9fa;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.9rem;
}

.control-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.stats-inline {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 0.85rem;
}

.stats-inline .stat-item {
    color: #6c757d;
    font-weight: 500;
}

.stats-inline .stat-value {
    margin-left: 3px;
    font-weight: 600;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-weight: 500;
}

.control-group input[type="radio"] {
    margin: 0;
}

button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

button:active {
    transform: translateY(0);
}

.input-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 15px 20px;
}

.input-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #e9ecef;
    transition: border-color 0.3s ease;
}

.input-container:focus-within {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.input-header {
    margin-bottom: 8px;
}

.input-header h4 {
    color: #2c3e50;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.char-count {
    color: #6c757d;
    font-size: 0.8rem;
    font-weight: 400;
    margin-left: 8px;
}

textarea {
    width: 100%;
    border: none;
    background: white;
    border-radius: 6px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    min-height: 180px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    border: 1px solid #dee2e6;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.stat-value.addition {
    color: #27ae60;
}

.stat-value.deletion {
    color: #e74c3c;
}

.stat-value.modification {
    color: #f39c12;
}

.result-section {
    padding: 15px 20px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.result-title {
    color: #2c3e50;
    font-size: 1rem;
    font-weight: 600;
}

.legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #6c757d;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.legend-color.addition {
    background-color: #d4edda;
}

.legend-color.deletion {
    background-color: #f8d7da;
}

.legend-color.modification {
    background-color: #fff3cd;
}

.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

.comparison-panel {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #e9ecef;
}

.panel-header {
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    padding-bottom: 5px;
    border-bottom: 1px solid #3498db;
}

.result-content {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 180px;
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.diff-addition {
    background-color: #d4edda;
    color: #155724;
    padding: 2px 4px;
    border-radius: 3px;
    border: 1px solid #c3e6cb;
}

.diff-deletion {
    background-color: #f8d7da;
    color: #721c24;
    padding: 2px 4px;
    border-radius: 3px;
    border: 1px solid #f5c6cb;
    text-decoration: line-through;
}

.diff-modification {
    background-color: #fff3cd;
    color: #856404;
    padding: 2px 4px;
    border-radius: 3px;
    border: 1px solid #ffeaa7;
}

.empty-state {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 50px 20px;
}

.empty-state::before {
    content: "📄";
    display: block;
    font-size: 3rem;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    body {
        padding: 4px;
    }
    
    .container {
        border-radius: 6px;
    }
    
    header {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 8px 12px;
    }
    
    .control-group, .stats-inline {
        justify-content: center;
    }
    
    .input-section {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 10px;
    }
    
    .comparison-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .result-section {
        padding: 12px;
    }
    
    .result-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .legend {
        justify-content: center;
    }
    
    textarea {
        min-height: 140px;
    }
    
    .result-content {
        min-height: 160px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 2px;
    }
    
    header h1 {
        font-size: 1.3rem;
    }
    
    .input-section,
    .result-section {
        padding: 8px;
    }
    
    .legend {
        flex-direction: column;
        gap: 8px;
    }
    
    .stats-inline {
        flex-direction: column;
        gap: 5px;
    }
}